简体   繁体   中英

How to connect to docker mysql container from Sequel Pro

I have spent almost 2 weeks googling this and trying out tons of different solutions out there, but none of them seem to work for me.

I'm using Docker for Mac (there's a whale icon in my toolbar).

I'm using this command to create mysql container:

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

Here's the output of 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

And I'm trying to connect to this container from Sequel Pro using the following settings:

Host: 127.0.0.1
Username: local
Password: local_password

And I'm getting the following error:

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

Anyone else having this problem, it turns out that this happens because of the latest (8+) version of mysql . 5.7 version works fine.

Can you try to change the host-port to eg 33306 instead of 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

What else you can try, is going into the container and verify whether the MySQL engine is working from there. You can do that by executing the following commands:

docker exec -ti database bash mysql -p

here's what you could try if you're still looking for the solution. You might need to provide access to your user from all sources using the following. grant all privileges on *.* to 'root'@'%' identified by ''; flush privileges;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM