Ext.: https://www.cnblogs.com/shiysin/p/shiysin.html
Today under a MySQL8.0, found that navicat connection is not, always error 1251;
The reason is that the MySQL8.0 version of the encryption method and MySQL5.0 is not the same, the connection will be error.
Tried a lot of ways, and finally found a way to achieve:
Change the encryption method
1. Enter the root account of MySQL from the command line first:
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 18Server version:8.0.11 mysql Community server-gplcopyright (c) $, 2018, Oracle an d/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. 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 your 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 the error ERROR 1396 (HY000): Operation ALTER USER failed for root '% ' :
The remote access permissions are incorrect, select the database First, and then change the following:
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)
(turn) Navicat connection MySQL8.0 Pro-Test effective