chkconfig not automatically starting mysql

8,023

Perhaps something went wonky when the init script was installed. I'd recommend the following:

chkconfig --del mysql
chkconfig --add mysql
chkconfig mysql on

Certainly can't hurt.

Share:
8,023

Related videos on Youtube

EGr
Author by

EGr

Updated on September 18, 2022

Comments

  • EGr
    EGr almost 2 years

    I have mysql set in chkconfig to automatically start when the system reboots:

    root@myserver:~#chkconfig mysql
    mysql  on
    

    However, this does not seem to be the case. When the system reboots, I get the following error on my PHP pages:

    SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    

    If I run service mysql start, the PHP pages begin to work (the above error does not appear, and queries return values). Is this an inappropriate configuration on my part? What else do I need to do to get mysql to start correctly after a reboot?

    Note: I'm running mysql on a SLES VM.

    • Kyle
      Kyle almost 11 years
      Is it able to start at all? Are you getting errors in the mysql logs?
    • EGr
      EGr almost 11 years
      It starts fine if I run service mysql start, but not at boot. My /var/log/mysqld.log file only shows from the point I ran service mysql start.
    • Stefan Lasiewski
      Stefan Lasiewski almost 11 years
      ps aux |grep mysql. It there another MySQL daemon running already?
    • EGr
      EGr almost 11 years
      No mysql process was running until I started it myself.
  • EGr
    EGr almost 11 years
    Are you talking about runlevels? If so, both network and mysql are set to 2,3, and 5
  • Wojciech Domalewski
    Wojciech Domalewski about 8 years
    chkconfig mysqld ...
  • anastrophe
    anastrophe about 8 years
    Not necessarily, it depends upon the distribution.