Sequel Pro和MySQL连接失败 [英] Sequel Pro and MySQL connection failed
问题描述
我刚刚从Homebrew在Mac上安装了mysql
I just installed mysql on mac from Homebrew
brew install mysql
mysql -V
mysql Ver 8.0.11 for osx10.13 on x86_64 (Homebrew)
在终端上它可以工作,我可以登录mysql,但是从Sequel Pro上说
from terminal it works and I can login to mysql but from Sequel Pro it says
无法连接到主机127.0.0.1,或者请求超时.
Unable to connect to host 127.0.0.1, or the request timed out.
请确保地址正确,并且您具有必要的地址 权限,或尝试增加连接超时(当前为10 秒).
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL表示:身份验证插件"caching_sha2_password"不能为 已加载:dlopen(/usr/local/lib/plugin/caching_sha2_password.so,2): 找不到图片
MySQL said: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2): image not found
不知道我在想什么
推荐答案
这是因为Sequel Pro尚未准备好进行新类型的用户登录,因为错误指出:没有驱动程序.非自制安装的快速修复:
This is because Sequel Pro is not ready yet for a new kind of user login, as the error states: there is no driver. Quick fix for non-homebrew installs:
Apple Logo > System Preferences > MySQL > Initialize Database
,然后输入新密码并选择使用旧密码"
Apple Logo > System Preferences > MySQL > Initialize Database
, then type your new password and select 'Use legacy password'
重新启动后,您应该可以连接了.仅在全新安装时才执行此操作,因为否则可能会丢失数据库表.
After restart you should be able to connect. Do it only on fresh installs, because you may lost your db tables otherwise.
基本上,您将必须手动执行一些操作,但是-您的数据库数据不会像上述解决方案中那样被删除
Basically you will have to perform some actions manually, however- your database data won't be deleted like in solution above
-
转到[my.cnf] [1]文件,然后在
[mysqld]
部分中添加行:
default-authentication-plugin=mysql_native_password
从终端登录mysql服务器:运行mysql -u root -p
,然后在shell内执行此命令(用您的实际密码替换 [password] ):
Login to mysql server from terminal: run mysql -u root -p
, then inside shell execute this command (replacing [password] with your actual password):
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[password]';
使用exit
从mysql shell退出并运行brew services restart mysql
.
exit from mysql shell with exit
and run brew services restart mysql
.
应该工作.
my.cnf文件位于Unix/Linux上的/etc/my.cnf中
The my.cnf file is located in /etc/my.cnf on Unix/Linux
这篇关于Sequel Pro和MySQL连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!