Friday, November 22, 2013

What Time did MySQL Start?

Time MySQL Server Started



From a mysql client just execute the following to see the date and time the server was started.

select now() - interval (variable_value/60/60/24) day -- \
from information_schema.global_status -- \
where variable_name='Uptime';

From the shell, this will provide the same information.

mysql -uroot -p -A -s  -e"select now() - interval (information_schema.global_status.VARIABLE_VALUE/60/60/24) day -- \"from information_schema.global_status where variable_name='Uptime';"


Sometime you may run into having to restart the mysqld under pressure. And it will not come up.  

One cause is the my.cnf file is modified some time after startup with a bad setting. You could use the results from the commands above and compare that to

stat /etc/my.cnf

to see if any changes were made to my.cnf that might prevent the server from re-starting.