So you’ve recently made a change to your mysql installation and see the following in
/var/lib/mysql/localhost.localdomain.err
080317 14:08:50 mysqld started
080317 14:08:50 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
080317 14:08:50 [ERROR] Aborting
080317 14:08:50 [Note] /usr/sbin/mysqld: Shutdown complete
080317 14:08:50 mysqld ended
This is a problem that many a time spent on google has not found the result, so I am writing here what exactly to do in this situation …
First off
cd /var/lib/mysql
Now run
ls -la
No doubt you will see something similar to this:
drwx--x--x 2 27 mysql 4096 Mar 17 14:05 mysql
Notice the “27 mysql”, the user no longer existsing in /etc/passwd.
This is fairly simple to fix.
adduser mysql
chown mysql:mysql -R /var/lib/mysql
Now start up Mysql i.e. “service start mysql” and everyhing should be fine.