[Modified the maximum number of Mysql connections and restarted Mysql, but the mysql container has been in the Restarting state]

insert image description here
View the logs of the mysql container

docker logs -f mysql

insert image description here
Error message: Variables are not bound in the modified configuration file. set GLOBAL MAX_USER_CONNECTIONS = 1000;
Mysql configuration file modification is wrong, you need to delete the Mysql container, recreate the Mysql container, and re-modify the maximum number of connections
delete the mysql container

docker rm -f mysql

After recreating the mysql container,
Enter inside the mirrored mysql container

docker exec -it mysql /bin/bash

Because there is no vim command inside the docker image, it needs to be installed manually, or you can use the docker cp command to copy it from the host

apt-get update
apt-get install vim

edit configuration file

vim /etc/mysql/mysql.conf.d/mysqld.cnf

Add at the end of the file:

max_connections=1024
max_user_connections=1024

Restart the mysql container

docker start mysql

View the running status of the mysql container

docker ps -a

mysql restarted successfully

Guess you like

Origin blog.csdn.net/simpleness_/article/details/130462263