docker-library/healthcheck

mysqladmin

andrey-dnh opened this issue · 1 comments

Hi,
you can try using mysqladmin to check whether the MySQL server is alive. I do the following in a project for blocking the docker start sequence until the server has been initialized. What happens is that a COM_PING packet is sent over the wire to the server. Here is some documentation about the COM_PING packet:
https://dev.mysql.com/doc/internals/en/com-ping.html

                while [[ `mysqladmin ping -uroot -p$$MYSQL_ROOT_PASSWORD 2>/dev/null` != "mysqld is alive" ]] ; \
                        do echo Waiting MySQL Server to start...; sleep 1; \
                done ; \

A SELECT query will increase a statistical variable about the queries. If someone is using it this will skew the results.

Ah, neat idea and good point; #16.