客戶端工具 root 遠程連接 MySQL 8

      用 Oracle SQL Developer 等客戶端工具遠程連接 MySQL 8 會有以下錯誤提示:

狀態: 失敗 -測試失敗: null,  message from server: "Host 'mysqlserver.lan' is not allowed to connect to this MySQL server"

       服務端登錄到 MySQL 中:

use mysql;
select host from user where user='root';
update user set host = '%' where user ='root';
flush privileges;

 

另,

      若是客戶端工具連接 MySQL 8 有提示 “狀態: 失敗 -測試失敗: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.” ,MySQL 服務端直接執行(重啓MySQL服務後將失效,適用於不便重啓服務的場景):

--查看當前MySQL設置的時區信息
show variables like '%time_zone%';

--全局時區修改爲東8區
set global time_zone='+8:00';

--當前會話的時區修改爲東8區
set time_zone = '+8:00';

      永久修改時區配置,可修改 C:\ProgramData\MySQL\MySQL Server 8.0\my.ini 文件。打開 my.ini ,搜索 default-time-zone,如果存在就修改其值爲 '+8:00' 。如果不存在,可在最後添加:

      注意:若修改 my.ini 配置文件後,無法重啓 MySQL 服務,可記事本打開 my.ini 文件,另存爲 ASIN 編碼 覆蓋之。

default-time-zone='+8:00';

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章