Navicat Premium报2059错误
使用Navicat Premium新建MySQL连接时,首先确保MySQL服务已开启,然后启动Navicat Premium,点击Connection新建连接,新建之前先Test Connection一下检查是否能连上MySQL,如下图Connection Name:自行命名,Host:localhost,Port:3306,User Name:root,Password:MySQL密码,测试通过绿灯亮,测试不通过红灯亮

当测试不通过且弹出Test Failed-2059错误时,原因是MySQL密码设置有问题,可能是密码位数或者密码含有不识别字符,修改MySQL密码即可,最好六位及以下密码,因为我原来设置的MySQL密码是'12345678',测试不通过,改成'123456'就通过了,具体原因没有细查

修改MySQL密码 :打开Mac终端命令行,输入
/usr/local/mysql/bin/mysql -u root -p
,然后输入你先前设置的MySQL密码,我先前设置的是12345678
,成功后进入mysql命令行,然后输入ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
注意后面的;
一定不能少,修改为密码123456
wdyzmxdeMacBook-Pro:~ xxx$ /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.00 sec)
mysql>
然后再测试Navicat Premium连接MySQL,测试通过如下图

测试通过后就能正常的新建MySQL连接了!
网友评论