簡體   English   中英

如何從 Sequel Pro 連接到 docker mysql 容器

[英]How to connect to docker mysql container from Sequel Pro

我花了將近 2 周的時間在谷歌上搜索並嘗試了大量不同的解決方案,但似乎沒有一個對我有用。

我正在使用 Docker for Mac(我的工具欄中有一個鯨魚圖標)。

我正在使用此命令來創建 mysql 容器:

docker container run -d -p 3306:3306 --name=database -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=local -e MYSQL_PASSWORD=local_password -v ~/.databases/mysql:/var/lib/mysql mysql

這是docker container logs database的輸出

2018-10-02T10:45:37.234437Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated
and will be removed in a future release.
2018-10-02T10:45:37.235186Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.12) starting as process 1
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
2018-10-02T10:45:37.927574Z 0 [System] [MY-010229] [Server] Starting crash recovery...
2018-10-02T10:45:37.927670Z 0 [System] [MY-010232] [Server] Crash recovery finished.
2018-10-02T10:45:38.012828Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-10-02T10:45:38.022161Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different
 directory.
2018-10-02T10:45:38.034910Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.034958Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.034976Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.034988Z 0 [Warning] [MY-010315] [Server] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.035012Z 0 [Warning] [MY-010323] [Server] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.2018-10-02T10:45:38.035036Z 0 [Warning] [MY-010323] [Server] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.035053Z 0 [Warning] [MY-010311] [Server] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.041121Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.041159Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2018-10-02T10:45:38.048971Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL

我正在嘗試使用以下設置從 Sequel Pro 連接到此容器:

Host: 127.0.0.1
Username: local
Password: local_password

我收到以下錯誤:

Unable to connect to host 127.0.0.1, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

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

任何其他遇到此問題的人,事實證明這是由於最新(8+)版本的mysql 5.7 版本工作正常。

您可以嘗試將主機端口更改為 33306 而不是 3306 嗎?

docker container run -d -p 33306:3306 --name=database -e MYSQL_ROOT_PASSWORD=root -e MYSQL_USER=local -e MYSQL_PASSWORD=local_password -v ~/.databases/mysql:/var/lib/mysql mysql

您還可以嘗試什么,進入容器並驗證 MySQL 引擎是否在那里工作。 您可以通過執行以下命令來做到這一點:

docker exec -ti database bash mysql -p

如果您仍在尋找解決方案,可以嘗試以下方法。 您可能需要使用以下方法從所有來源向您的用戶提供訪問權限。 grant all privileges on *.* to 'root'@'%' identified by ''; 刷新權限;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM