mysql迁移至8.0时的注意事项(小结)
密码模式
PDO::__construct():Theserverrequestedauthenticationmethodunknowntotheclient[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、更新账号的密码模式
#创建新的账号 createuser'root'@'%'identifiedwithmysql_native_passwordby'123456'; #已存在的账号 alteruser'root'@'%'identifiedwithmysql_native_passwordby'123456';
3、如果你需要授权
#授权也不能兼并创建账号了,只能授权 grantallprivilegeson*.*to'root'@'%'withgrantoption; flushprivileges;
密码复杂度策略
ERROR1819(HY000):Yourpassworddoesnotsatisfythecurrentpolicyrequirements
密码复杂度验证策略导致的,关闭后设定即可
setglobalvalidate_password.policy=0; setglobalvalidate_password.length=6;
默认编码
PDO::__construct():Serversentcharset(255)unknowntotheclient.Please,reporttothedevelopers
设定mysql服务的默认编码
#DefaultHomebrewMySQLserverconfig [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
updatemysql.usersethost='%'whereuser='root';
到此这篇关于mysql迁移至8.0时的注意事项(小结)的文章就介绍到这了,更多相关mysql迁移至8.0内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!