Sunday, January 16, 2011

How do I get MySQL to run at startup under user `mysql`?

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?

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

    cool-RR : 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!
    From e-t172
  • 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
    
    From Nexus
  • 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
    

0 comments:

Post a Comment