linux 安裝mysql8 設置遠程連接失敗的問題


1、數據庫安裝完,設置遠程連接 ,參考鏈接:https://blog.csdn.net/yunyexiangfeng/article/details/82876964

通常grant all privileges on *.* to 'user'@'%' identified by 'passowr';命令授權遠程連接操作。(失敗)

mysql的官方文檔,原來這個特性被移除了,下面看文檔說明:

Using GRANT to modify account properties other than privilege assignments. This includes
authentication, SSL, and resource-limit properties. Instead, establish such properties at account-creation
time with CREATE USER or modify them afterward with ALTER USER
使用grant修改賬戶權限分配以外的賬戶屬性。包括認證,SSL,和資源限制配置等。取而代之的是創建用戶create user或者創建后修改alter user的方式。

可以使用以下方式:

1.alter user set user.host='%' where user.user='root',此時印證官方doc說的使用alter user

2.create user 'userName'@'%' identified ...,創建新用戶,此時使用create user

工具登錄數據庫問題:

mysql8密碼加密方式的更改:

之前默認是mysql_native_password,現在改為caching_sha2_password。很多連接工具,像nivacat12,仍然使用默認的mysql_native_password,所以在連接的時候回報錯:

1251:Client does not support authentication protocol requested by server; consider upgrading
MySQL client

此時需要將mysql.user表中的plugin字段修改下:

ALTER USER user IDENTIFIED WITH mysql_native_password BY 'password';


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM