歡迎您光臨本站 註冊首頁

mysql遷移至8.0時的注意事項(小結)

←手機掃碼閱讀     madbeef @ 2020-05-15 , reply:0

密碼模式

PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

mysql8 之後,默認的密碼模式改為 caching_sha2_password,新的模式需要新的驅動,至少現在 pdo / navicat 還沒給出,所以我們還是得切換成老的 mysql_native_password 模式。

`mysql_native_password`:7.0 以下 `caching_sha2_password`:8.0 以上


1、my.cnf 配置默認的密碼模式

[mysqld] default_authentication_plugin=mysql_native_password


2、更新賬號的密碼模式

# 創建新的賬號
create user 'root'@'%' identified with mysql_native_password by '123456';
# 已存在的賬號
alter user 'root'@'%' identified with mysql_native_password by '123456';


3、如果你需要授權

# 授權也不能兼併創建賬號了,只能授權
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;


密碼複雜度策略

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

密碼複雜度驗證策略導致的,關閉後設定即可

set global validate_password.policy=0;
set global validate_password.length=6;


默認編碼

PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers

設定 mysql 服務的默認編碼

# Default Homebrew MySQL server config [client]
default_character_set=utf8mb4 [mysql]
default_character_set=utf8mb4 [mysqld]
default_authentication_plugin=mysql_native_password
character_set_server=utf8mb4 collation_server=utf8mb4_general_ci


遠程訪問

1、my.conf 註釋掉本地監聽

[mysqld] #bind_address=127.0.0.1


2、更新賬號的 host

update mysql.user set host='%' where user='root';


[madbeef ] mysql遷移至8.0時的注意事項(小結)已經有382次圍觀

http://coctec.com/docs/mysql/show-post-234637.html