我的個人博客:https://lixiaohui.live
Error提示
原因:
mysql8 之前的版本中加密規(guī)則是mysql_native_password
婚惫,而在mysql8之后,加密規(guī)則是caching_sha2_password
闽撤。那么我們需要把mysql用戶登錄密碼加密規(guī)則還原成mysql_native_password
。
解決方法:
1).打開命令行小黑屏栓霜,進入MySQL的bin目錄瘟栖,然后輸入mysql -u root -p
,輸入密碼蜡豹,如下所示:
C:\Users\v_xmmxhli>cd C:\Program Files\MySQL\MySQL Server 8.0\bin
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 8.0.12 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).然后輸入
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用戶的密碼
FLUSH PRIVILEGES; #刷新權(quán)限
窗口給出的反應(yīng)是:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Mysql';
Query OK, 0 rows affected (0.20 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)
3).再次在Navicat里驗證一下麸粮,連接成功
Navicat重試連接
Note:注意中英文單引號不要輸錯了~