MySql教程

docker 启动mysql

本文主要是介绍docker 启动mysql,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

创建配置文件

[mysqld]
pid-file    = /var/run/mysqld/mysqld.pid
socket        = /var/run/mysqld/mysqld.sock
datadir        = /var/lib/mysql
log-error    = /var/log/mysql/error.log
symbolic-links        = 0
default-time-zone    = '+8:00'
log_timestamps        = system
character-set-server= utf8mb4 
collation-server    = utf8mb4_unicode_ci
log-bin                = mysql-bin
binlog_format        = ROW
max_binlog_size     = 100M
expire_logs_days    = 0 
server_id            = 11

 

启动

 

docker run --rm --name some-mysql \
-v /etc/localtime:/etc/localtime:ro \
-v /root/mysql/conf:/etc/mysql/mysql.conf.d \
-v /root/mysql/data:/var/lib/mysql \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-e TZ=Asia/Shanghai \
-d mysql:5.7.36

 

这篇关于docker 启动mysql的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!