错误消息:无法连接到数据库服务器

时间:2019-05-18 08:59:16

标签: mysql sql

我正在尝试设置SQL环境:

  • MacOS Sierra 10.12.6

  • MySQL Community Server 8.0.16-macOS 10.14(x86,64位),DMG存档(我没有找到较低的版本)

  • MySQL Workbench 8.0.16 mysql-workbench-community-6.3.10-macos-x86_64.dmg

我正在遵循本指南:https://youtu.be/7S_tz1z_5bA?t=836 对于我来说,当我单击“测试连接”时,会显示以下错误消息:

Cannot Connect to Database Server

Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
  Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

Please:
1 Check that mysql is running on server 127.0.0.1
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines) 
4 Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from

我发现了与我的PC和Linux类似的UNANSWERED问题。

有人建议Authentication plugin 'caching_sha2_password' cannot be loaded解决了我的问题。它甚至不是同一条错误消息,因为它询问和错误

Authentication plugin 'caching_sha2_password' cannot be loaded: 
dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

2 个答案:

答案 0 :(得分:2)

您可以只使用PostgreSQL,它比MySQL简单得多

他们的主要网站:https://www.postgresql.org/

您可以从此处下载适用于macOS的版本:https://www.postgresql.org/download/macosx/

我建议使用“姿势”应用程序,因为它具有GUI:https://postgresapp.com/

对于客户端,我建议使用pgAdmin 4:https://www.pgadmin.org/download/pgadmin-4-macos/

还有一个教学视频:https://www.youtube.com/watch?v=wCMXbM5J0X8

答案 1 :(得分:0)

您可以像这样更改密码的加密。

ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';