When the server runs mysql: Error response from daemon: Container xxx is not running

After I installed mysql, an error occurred when I entered the mysql container through this command:

docker exec -it mysql /bin/bash

Then I went to the Internet to see the processing process. Many blogs said that as long as the docker is restarted, but mine keeps reporting errors.

my suggestion is:

The first step is to check the error log:

docker logs+容器id

Through this, you can find the place where the error occurred. For many places where the same error is reported, the processing method is different.

My logs show that the problem is:

 mysqld failed while attempting to check config
        command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.XeHsvFblmW
        mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)

By consulting the blog, it was determined that the problem was:

By viewing the log of the container, we can see that the main reason is that the /etc/mysql/conf.d/ directory cannot be read .

The solution is:

will start the mysql service command:

docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root  \
-d mysql:5.7

change into:

docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=root  \
-d mysql:5.7

Finally, problem solved.

Guess you like

Origin blog.csdn.net/weixin_45987528/article/details/129665633