之前使用Navicat連接配接MySQL時, 一直報錯1251, 到處查找資料隻能找到個解決方法,但是原因還是不清楚。
後來知道了報1251是因為MySQL使用者密碼加密問題。mysql8之前的版本中加密規則是mysql_ native_ password, 而在mysql8之後,加密規則是caching_ sha2_ password。
關于如何修改密碼加密規則,可以使用指令的方式
#更新加密規則
alter user root@localhost identified by 'password' password expire never;
#更新密碼
alter user root@localhost identified with mysql_native_password by 'password' ;
# 重新整理權限
flush privileges;
當然,知道了問題所在,我們在下次安裝mysql時,應該要注意密碼的加密規則的修改,避免不必要的麻煩。