mysql8.0 and Navicate11.2 連接報錯問題 親測有效:記錄一下僅供提醒本身mysql
原創:sql
https://blog.csdn.net/xdmfc/article/details/80263215數據庫
今天下了個 MySQL8.0,發現Navicat鏈接不上,老是報錯1251;session
緣由是MySQL8.0版本的加密方式和MySQL5.0的不同,鏈接會報錯。加密
試了不少種方法,終於找到一種能夠實現的:.net
更改加密方式命令行
步驟1:先經過命令行進入mysql的root帳戶:mysql -uroot -p***(輸入本身的用戶名密碼)code
步驟2:更改加密方式:mysql>
ALTER
USER
'root'
@
'localhost'
IDENTIFIED
BY
'password'
PASSWORD
EXPIRE NEVER;
blog
顯示:Query OKget
步驟3:更改密碼:mysql>
ALTER
USER
'root'
@
'localhost'
IDENTIFIED
WITH
mysql_native_password
BY
'123'
;(123爲例子改爲本身的mysql用戶密碼)
顯示:Query OK
步驟4:刷新:mysql> FLUSH
PRIVILEGES
;
完成上述步驟,我是成功的
// 若是報錯ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%':
則是遠程訪問權限不正確,先選擇數據庫,查看一下再更改:
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)