Today I have changed mysql config file and restarted mysql with:
service mysql restart
And saw the following:
Stopping mysql database server: mysqld.
Starting mysql database server: mysqld. Checking for corrupt, not cleanly closed and upgrade needing tables..
After that the mysql service started working, but later I saw errors on my website and realized that InnoDB engine was not started.
In /var/log/daemon.log I saw the following lines:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 67108864 bytes!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
I deleted the log files and restarted mysql, but that's not the question.
The question is:
How can I know there were errors on starting mysql without looking into daemon.log file? Maybe it's possible to setup printing mysql startup errors to stdout?
The daemon.log gets filled by syslog. So the only way see what happens in there during a normal startup is to type in another shell
If you want to be warned of bigger issues you can modify the init script. I had a quick look in the mysql init script:
/etc/init.d/mysql
and found thatlogger
is used to log the errors to/var/log/daemon.err
:With adding a "-s" to the second line, the errors will also be logged to stderr.
Permanently printing error messages to stdout instead of logging them in a file is NOT a good idea for several reasons:
It may be useful to do so when debugging some issue during daemon startup. This can be done by just executing the process manually without forking. On my system, mysql process will not detach from terminal when I invoke it using
sudo mysqld
.