【发布时间】:2017-05-28 23:12:54
【问题描述】:
我想更改 mysql docker 容器的默认公开端口,但如果我尝试使用此命令:
docker run --detach --name=test-mysql -p 52000:52000 --env="MYSQL_ROOT_PASSWORD=mypassword" mysql
它不起作用。 mysql -uroot -pmypassword -h 127.0.0.1 -P 52000
Warning: Using a password on the command line interface can be insecure.
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
如果我使用标准端口 3306:3306 那么它工作正常,但我想更改端口。可以吗?
我已经尝试过 -p 52000:3600 ,但我总是得到:
mysql -uroot -pmypassword -h 127.0.0.1 -P 52000
Warning: Using a password on the command line interface can be insecure.
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
【问题讨论】:
-
使用
-p 52000:3306? -
不行,我已经试过了
-
this is a solution ,关闭我的windows防火墙后,连接正常