我花了将近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
答案 0 :(得分:2)
其他任何人都有此问题,原来是由于mysql
的最新(8+)版本引起的。 5.7版本工作正常。
答案 1 :(得分:0)
您能否尝试将主机端口更改为例如是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