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?
ib_logfile0
andib_logfile1
are not log files in the normal sense of the word. They are used for temporarily storing data before it is written to the correct InnoDB files in order to increase throughput and improve response times due to sequential writing. If you delete these files while MySQL is running or after it has crashed you will most likely lose data. This is how to do it safely.