解決MySQL8.0報(bào)錯(cuò)Client does not support authentication protocol requested by server; consider upgrading MySQL client問題
原創(chuàng):丶無殤??2023-10-07
報(bào)錯(cuò)內(nèi)容
使用node.js連接數(shù)據(jù)庫MySQL 8時(shí)候,報(bào)錯(cuò)ER_NOT_SUPPORTED_AUTH_MODE
,并且提示Client does not support authentication protocol requested by server; consider upgrading MySQL client
:客戶端不支持服務(wù)器請(qǐng)求的身份驗(yàn)證協(xié)議;考慮升級(jí)MySQL客戶端;
報(bào)錯(cuò)原因
最新的MySQL模塊并未完全支持MySQL 8.0的caching_sha2_password
加密方式,而MySQL 8.0中默認(rèn)仍然是caching_sha2_password
加密方式,因此用戶認(rèn)證不通過了。
如下查詢:
mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.02 sec)
這里的“123456”是你自己的密碼
解決方法
直接數(shù)據(jù)庫工具里面修改加密方式mysql_native_password:
或者通過指令方式修改:文章來源:http://www.zghlxwxcb.cn/news/detail-728222.html
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.01 sec)
數(shù)據(jù)庫連接和關(guān)閉都成功,連接問題解決文章來源地址http://www.zghlxwxcb.cn/news/detail-728222.html
到了這里,關(guān)于解決MySQL8.0報(bào)錯(cuò)Client does not support authentication protocol requested by server...問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!