赞
踩
【报错原因】mysql8.0 之前的版本中加密规则是 mysql_native_password,而 mysql8.0 之后的版本加密规则是caching_sha2_password
【解决方案】修改 mysql8.0 的加密规则
# 连接 mysql 服务器 mysql -u root -p # 进入 mysql 数据库 mysql> use mysql; # 查看 user 表 mysql> select user,host from user; # 设置登录密码永不过期(password改为自己的) mysql> alter user 'root'@'localhost' identified by 'password' password expire never; mysql> alter user 'root'@'%' identified by 'password' password expire never; # 修改加密规则(password改为自己的) mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'password'; mysql> alter user 'root'@'%' identified with mysql_native_password by 'password'; # 刷新权限 mysql> flush privileges; # 退出 mysql> quit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。