mysql8用navicat可视化连接会报错加密方式错误,想要连接mysql8有两种方式
1:安装MySQL8客户端
2:修改MySQL8的密码加密方式
我采用的是第二种,因为服务器上是MySQL8,而我本地是MySQL5,不想在装一个MySQL8,要是换电脑还要在装一个MySQL8,觉得有点麻烦。
以下是通过查资料总结出来的修改方法以及修改过程中可能会出现的问题。时间有点久了,查到的资料地址忘记了,就剩了个修改记录。
// 登陆
mysql -uroot -p
// 更改加密方式
mysql> ALTER USER ‘root‘@‘%‘ IDENTIFIED BY ‘password‘ PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.02 sec)
// 更改密码
mysql> ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘pwd12345‘; Query OK, 0 rows affected (0.03 sec)
// 刷新
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)
// 如果报错 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
使用以下:
mysql> set global validate_password.policy=0; Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password.length=8; Query OK, 0 rows affected (0.00 sec)
// 如果报错 ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘%‘:
mysql> use mysql; Database changed mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+-----------+ <strong>5</strong> rows in set (<strong>0.00</strong> sec)
原文地址:https://www.cnblogs.com/milude0161/p/9228295.html
时间: 2024-11-06 20:00:52