mysql迁移至8.0时应该注意什么

这篇文章主要为大家展示了mysql迁移至8.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';

以上就是关于MysqL迁移至8.0时应该注意什么的内容,如果你们有学习到知识或者技能,可以把它分享出去让更多的人看到。

相关文章

优化MySQL数据库发布系统存储的方法有:1.mysql库主从读写分...
使用mysql的方法:在“我的电脑”→右键→“管理”→“服务”...
在mysql中查看root用户权限的方法:1.命令行启动mysql服务;...
MySQL主从复制是用来备份一个与主数据库一样环境的从数据库,...
运行mysql的方法1.启动mysql服务,在“我的电脑”→右键→“...
开启mysql的方法1.可以通过快捷键win+r,输入cmd,打开窗口,...