溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

mysql遷移至8.0時應(yīng)該注意什么

發(fā)布時間:2020-07-27 14:33:07 來源:億速云 閱讀:210 作者:小豬 欄目:MySQL數(shù)據(jù)庫

這篇文章主要為大家展示了mysql遷移至8.0時應(yīng)該注意什么,內(nèi)容簡而易懂,希望大家可以學習一下,學習完之后肯定會有收獲的,下面讓小編帶大家一起來看看吧。

密碼模式

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

mysql8 之后,默認的密碼模式改為 caching_sha2_password,新的模式需要新的驅(qū)動,至少現(xiàn)在 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、更新賬號的密碼模式

# 創(chuàng)建新的賬號
create user 'root'@'%' identified with mysql_native_password by '123456';

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

3、如果你需要授權(quán)

# 授權(quán)也不能兼并創(chuàng)建賬號了,只能授權(quán)
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;

密碼復雜度策略

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

密碼復雜度驗證策略導致的,關(guān)閉后設(shè)定即可

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

設(shè)定 mysql 服務(wù)的默認編碼

# 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 注釋掉本地監(jiān)聽

[mysqld]
#bind_address=127.0.0.1

2、更新賬號的 host

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

以上就是關(guān)于mysql遷移至8.0時應(yīng)該注意什么的內(nèi)容,如果你們有學習到知識或者技能,可以把它分享出去讓更多的人看到。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI