使用docker安装mysql8.0.27

docker run \
    -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=root \
    -v /data/docker_vol/mysql108/data:/var/lib/mysql:rw \
    -v /data/docker_vol/mysql108/conf:/etc/mysql/conf.d \
    --name mysql108 \
    --restart=always \
    -d mysql:8.0.27 \
    --lower_case_table_names=1

/data/docker_vol/mysql108/conf/下使用了旧的my.cnf 文件。
启动后发现3306端口不通,

2022-01-04T09:08:26.395819Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-01-04T09:08:26.399097Z 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.
2022-01-04T09:08:26.413400Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2022-01-04T09:08:26.413493Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.

经过大量实验,发现conf/目录下不应该有文件,或者文件内容有问题。去掉cnf文件后
正常的情况是:

2022-01-04T09:14:40.419019Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

外网访问也正常了

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐