Navicat连接mysql时候出现1251错误代码
出现1251错误代码
是因为mysql8.0的密码加密方式与之前5.0的不同
如果是字母式的密码 比如root 可能会出现这种情况
1.先通过命令行进入mysql的root账户
1 Enter password: **** 2 Welcome to the MySQL monitor. Commands end with ; or \g. 3 Your MySQL connection id is 10 4 Server version: 8.0.17 MySQL Community Server - GPL 5 6 Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 7 8 Oracle is a registered trademark of Oracle Corporation and/or its 9 affiliates. Other names may be trademarks of their respective 10 owners. 11 12 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
2.更改加密方式
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.08 sec)
3.更改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; Query OK, 0 rows affected (0.02 sec)
4.刷新
1 mysql> FLUSH PRIVILEGES; 2 Query OK, 0 rows affected (0.01 sec)
5.完成