Cannot access MySQL Database - PID file could not be found

5,300

Here is something you can do. Since the process is not running and it is not finding a pid file, you can designate it in your my.cnf file:

  1. Use a text editor like Vim or Nano to access /etc/my.cnf
  2. Add the following: pid-file = /var/run/mysqld/mysqld.pid
  3. Create the directory/file:

mkdir /var/run/mysqld touch /var/run/mysqld/mysqld.pid chown -R mysql:mysql /var/run/mysqld

  1. Start up MySQL: service mysql start
  2. Tail log files to make sure MySQL starts up correctly: tail -f /path/to/mysql.log
Share:
5,300

Related videos on Youtube

MRF
Author by

MRF

Updated on September 18, 2022

Comments

  • MRF
    MRF over 1 year

    I am using a Linux Server from GoDaddy, and without any known reason, PID file could not be found! These are the errors I got:

     # mysql
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    
    # service mysqld status
    mysqld: unrecognized service
    
    # service mysql stop
    ERROR! MySQL manager or server PID file could not be found!
    
    # service mysql start
    ERROR! Manager of pid-file quit without updating file.
    
    # mysqladmin retart
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
    
    • Matej Vrzala M4
      Matej Vrzala M4 over 5 years
      I run into this from time to time... Can you run ps -ef | grep mysql and post the output
    • MRF
      MRF over 5 years
      @ryekayo -- I get this: root 15953 20471 0 15:56 pts/0 00:00:00 grep mysql
  • MRF
    MRF over 5 years
    after stage 4, I get this: Starting MySQL. ERROR! Manager of pid-file quit without updating file.
  • Matej Vrzala M4
    Matej Vrzala M4 over 5 years
    Can you post the output and the contents of your log file in your question?
  • MRF
    MRF over 5 years
    I am not sure which log to check. I think it can be something about InnoDB --- I tried to post the log, but it is too long