how to restart mysql service from mysql docker container

Viewed 31334

I'm using tommylau/mysql docker image which provides mysql installed.

But after all i can't find how to restart mysql service inside running container (there is no mysql service or /etc/init.d/mysqld)

Any idea how to find how to restart mysql?

2 Answers

If you log into the container and attempt to restart the service it will essentially kill the container at the point in which the mysql process stops and therefore it'll never start (as the container has exited).

The best way is to simply restart the container using the following command:

docker restart [ContainerID]

An easy was going into your container

docker exec -it [containername/id] bin/bash

after entering the container restart mysql

restart mysql

or just restart your container like in the answer above

Related