navicat always reports error 1251 when connecting to MySQL8.0 and above versions; the reason is that the encryption method of MySQL8.0 version is different from that of MySQL5.0, and the connection will report an error. Below I will introduce you to the detailed solution.
Recommended tutorial: MySQL database introductory video tutorial
1. First enter mysql through the command line root account:
PS C:\Windows\system32> mysql -uroot -p
Enter the root password:
Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
2. Change the encryption method:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.10 sec)
3. Change password: In this example, 123 is the new password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123'; Query OK, 0 rows affected (0.35 sec)
4. Refresh:
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.28 sec)
// If an error is reported ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%':
The remote access permissions are incorrect. Select the database first, check it and then change it:
mysql> use mysql; Database changed mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+-----------+ 5 rows in set (0.00 sec)
Finally, restart the MySQL service and reconnect. .
The above is the detailed content of navicat error 1251. For more information, please follow other related articles on the PHP Chinese website!