1. 程式人生 > >連線mysql報錯#1251解決方案

連線mysql報錯#1251解決方案

真的是很激動,修改了好幾天mysql與其使用工具的連線問題,終於修改成功

錯誤問題是本地的mysql服務加密方式有問題,在使用工具上會報錯#1251的錯誤

修改方法:

1. 建議將之前的mysql服務刪除掉,具體刪除方法網上很全
2.安裝好新的mysql後,cd 命令進入mysql安裝的bin目錄下
3.輸入密碼(初始化mysql會有預設密碼,注意捕獲)

2018-10-06T02:58:06.216123Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]:

後會提示:
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 © 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.mysql>

4.更改加密方式

mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;

會提示:Query OK, 0 rows affected (0.10 sec)

5.更改密碼(以 1234 為例子 ):

mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘1234’;

6.重新整理:mysql> FLUSH PRIVILEGES;

然後到mysql的使用工具中測試就可以了,連線屬性裡密碼是修改過的,要留意下。