I'm using MySQL on CentOS and I want it to run at startup under the mysql user. I tried /sbin/chkconfig --level 35 mysqld on from my cool-RR user, but it seems like this makes mysql try to run as cool-RR. How do I make it run on startup as user mysql?

link|improve this question

68% accept rate
feedback

3 Answers

up vote 2 down vote accepted

It should start as mysql user by default. You are probably starting the daemon under your own user account, you should use the startup script instead, which will execute using the config files in /etc

i.e.

service mysqld stop
service mysqld start
link|improve this answer
feedback

In /etc/mysql/my.cnf, set "user" to "mysql" in the [mysqld] section.

link|improve this answer
There was no /etc/mysql/my.cnf, only /etc/my.cnf, and the thing you said was already set to "mysql", but it's not working! – Ram Rachum Sep 17 '09 at 0:48
feedback

Execute the following commands from under your account:

su
chkconfig mysqld on

Then you can restart service by service mysqld restart. You can check which user it is running under by issuing

ps aux | grep mysqld
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.