Sign inSign up

shinejh0528/mysql

By shinejh0528

Updated 9 months ago

mysql

Image
Databases & storage
0

10K+

shinejh0528/mysql repository overview

Running

Usage

basic
docker run -itd -p 3306:3306 --name mysql shinejh0528/mysql:9.3.1

You can give my.cnf by parameter 'mycnf'. When you use this parameter, you have to give volume which contains my.cnf.
docker run -itd -p 3306:3306 -v /data/mysql_docker_test/:/data/mysql -v ~/script/docker/mysql/1.1.0/config:/data/config -e mycnf=/data/config/my.cnf -e root_password=root --name mysql shinejh0528/mysql:9.3.1
  • volume /data/mysql : It contains MySQL database data that is written in my.cnf.
  • volume /data/config : It Contains my.cnf (/data/config/my.cnf). You can see parameter mycnf is '/data/config/my.cnf'.
  • -e mycnf : my.cnf path
  • -e root_password (Requires shinejh0528/mysql:9.3.1 or higher) : root init password (default is 'root')





Troubleshooting

run mysql service in container
docker exec -it [container id] /bin/bash
service mysql start

you can check my.cnf
cat /etc/mysql/my.cnf

If you run mysql for the first time in your server using docker, then you will confront of error.
Follow this to handle error
1. mysql init
mysqld --initialize-insecure --user=mysql
2. service start
service mysql start
# change password
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; FLUSH PRIVILEGES;"





mycnf example

[mysqld]
#port=3307
datadir=/data/mysql
log-bin=/data/mysql/mysql-bin.log
server-id = 1
expire_logs_days = 10
max_binlog_size = 100M
log_bin_trust_function_creators = 1
collation-server = utf8mb4_general_ci
default-time-zone = "+09:00"
max_connections = 500
pid-file = /var/run/mysqld/mysqld.pid

[mysqldump]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

Tag summary

Content type

Image

Digest

sha256:6bddbee40

Size

346.1 MB

Last updated

9 months ago

docker pull shinejh0528/mysql:9.5.0