mac上用homebrew安装mysql步骤:
1.brew install mysql(默认安装mysql8)
安装完成后:启动mysql服务
2.bash mysql.server start
这个时候用navicat 连接会报错2059 Authentication plugin ‘caching_sha2_password‘ cannot be loaded
这是因为新版mysql数据库的加密方式变了:
3.登录数据库 mysql -u root -p
4.通过命令 select user,plugin from user where user=‘root‘; 我们可以发现加密方式是caching_sha2_password
执行这个语句时如果报错“ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘%‘”, 执行这个语句alter user ‘root‘@‘localhost‘ identified with mysql_native_password by ‘your password‘; 如果还是报错就执行第6步,如果没报错就走第7步
6.保留当前窗口,新打开一个窗口,重新进入mysql,执行该命令就可以了
再次查看,就发现加密方式已经更改:
7.接着找到my.cnf文件(不知道目录的可以通过brew list mysql来确定目录)并加上加密方式:
default_authentication_plugin=mysql_native_password
作者:Mike
原文作者:有梦南柯
链接:https://www.jianshu.com/p/06897ac9f25d
原文来源:简书
原文:https://www.cnblogs.com/mike-JP/p/12047476.html