The content of this article is about the method of connecting Navicat to MySQL8.0 (effective). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
I downloaded MySQL 8.0 today and found that Navicat could not connect and always reported error 1251;
The reason is that the encryption method of MySQL 8.0 version is different from that of MySQL 5.0 , the connection will report an error.
After trying many methods, I finally found one that can be implemented:
Change the encryption method
1. First enter the mysql root account through the command line:
PS C:\Windows\system32> mysql -uroot -p
Then 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 the password:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; 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 permission is not Correct, 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 | +------------------+-----------+ rows in set (0.00 sec)
The above is the detailed content of How to connect Navicat to MySQL8.0 (effective). For more information, please follow other related articles on the PHP Chinese website!