ITChristian
ITChristian

Reputation: 11271

MySql server PID not found

I have CentOS 6.4 with NGINX.

When I try to start/stop/restart mysql server (/etc/init.d/mysqld restart) I get this error:

MySQL server PID file could not be found!                  [FAILED]
Starting MySQL..The server quit without updating PID file ([FAILED]/mysql/mysqld.pid).

What can I do to solve this problem?

Thanks!

Upvotes: 10

Views: 52465

Answers (6)

Balkrushna Patil
Balkrushna Patil

Reputation: 466

First of all make sure that which folder/file is not exist in /var/run/mysqld/mysqld.pid

if dir not exists then create it as:

sudo mkdir -p /var/run/mysqld/

if mysqld.pid is not exists then create it as:

sudo touch /var/run/mysqld/mysqld.pid

change ownership as:

sudo chown mysql:mysql -R /var/run/mysqld
chmod 775 -R /var/run/mysqld

restart mysql service

sudo service mysql restart

Upvotes: 3

jafo
jafo

Reputation: 1

I found this worked....

# ps aux | grep mysql
root      3668  0.0  0.0  11432  1240 ?        S     2014   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/db/data01 --pid-file=/var/lib/mysql/mysql.pid
mysql     5303  0.1  0.4 1964748 12368 ?       S<l   2014 1663:35 /usr/sbin/mysqld --basedir=/usr --datadir=/db/data01 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/db/logs01/mysql-error.err --open-files-limit=8192 --pid-file=/var/lib/mysql/mysql.pid --socket=/var/lib/mysql/mysql.sock --port=3306
root     12369  0.0  0.0   6376   680 pts/0    S+   09:05   0:00 grep mysql
# kill -9 3668 5303
# rm /var/lock/subsys/mysql rm: remove regular empty file `/var/lock/subsys/mysql'? y
# service mysql start Starting MySQL (Percona Server).. SUCCESS!

Upvotes: 0

gdm
gdm

Reputation: 7968

Check if there is a lock.

/etc/init.d/mysql status

If the OS says that there is a lock, something like:

ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

remove that lock file and restart.

Upvotes: 0

Selwyn Polit
Selwyn Polit

Reputation: 559

I find that sometimes MySQL processes are still running. Certainly this was the case on my OS X Yosemite system so use the following command to find any processes that show up with MySQL in the name:

ps aux | grep mysql

Then kill them using the command sudo kill -9 PID, replacing PID with the offending process ID.

Upvotes: 1

arpiagar
arpiagar

Reputation: 4704

I upgraded my Mac OS to 10.9.3 and encountered the above problem on mysql.server restart

The following fixed my problem

sudo chmod -R o+rwx /usr/local/var/mysql/
sudo chown -R mysql /usr/local/var/mysql/
sudo mysql.server restart

Upvotes: 3

Ciprian Stoica
Ciprian Stoica

Reputation: 2439

I got the same error on a CentOS 6.3 where I upgraded MySQL to 5.6.14 but I kept the old my.cnf file. After upgrade, MySQL did not start anymore, giving me the same error as you described.

The problem was that I had this setting in my.cnf:

table_cache=2048

According to this link table_cache renamed table_open_cache..

"Seem like in 5.5 the system variable table_cache was renamed table_open_cache.. In 5.6 mysqld fails if it finds an unknown variable this means that upgrades from versions earlier than 5.5 can have problems if table_cache is specified in my.cnf."

After I changed the above line to

table_open_cache=2048

MySQL started perfectly.

So, in the case you have MySQL 5.5+ (and maybe an older my.cnf), I suggest you to do the following:

  • remove my.cnf from /etc folder and try to start MySQL
  • if MySQL starts, the the problem is in my.cnf. Comment/uncomment all the settings one by one in order to see which is causing the problem.

Hope this helps.

Upvotes: 7

Related Questions