Error mysql server pid file could not be found

This question is a bit outdated but I thought I'd post how I resolved this issue when it happened to me on my Mac (OS X El Capitan 10.11.4).

Check the status just to be sure

mysql.server status

ERROR! MySQL is running but PID file could not be found

Find all running mysql processes

ps aux | grep mysql

It will list out all the processes using mysql (including the command you just executed)

Kill off all the mysql pids

sudo kill    ...

This should kill off all the mysql processes

Now try to fire mysql up

mysql.server start

Starting MySQL . SUCCESS!

Hope this helps someone!


EDIT: Alternative solution from @DanielTate

This worked for me JasperSoft Wiki - uninstall-mysql-mac-os-x. I had to brew uninstall mysql then delete ALL of the files then reinstall and follow the home brew install instructions


EDIT 2: Alternative solution from @JanacMeena

There is a nice write-up of their solution in this post on Medium.

The MySql server PID file could not be found error occurs when MySQL cannot find the PID file. It may also occur if the MySQL process is killed abruptly. Since the process does not end properly, the PID file is mismatched.

Solution

Step 1. Check for the parameter PID-file and create /var/run/mysqld/

Check where your PID-file points to. You can do this by running:

my.cnf

If the parameter is not present, set it as shown below:

pid-file    = /var/run/mysqld/mysqld.pid

Next, create the following directory and give it the appropriate permissions, as follows:

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

Step 2. Change ownership of the MySQL folder

Change the ownership of the MySQL folder:

sudo chown -R _mysql:_mysql mysql

Step 3. Change permissions of the MySQL folder

You can change the permissions of the MySQL folder by typing:

sudo chmod 777 /usr/local/var/mysql

Change permissions of /usr/local/var

If the above solutions do not work, try changing the permissions of /usr/local/var by typing:

sudo chmod 777 /usr/local/var

I am having an issue where MySQL isn't starting on my QNAP NAS.

I found this first by not being able to log in through phpMyAdmin - was getting error:

#2002 Cannot log in to the MySQL server

I then went to attempt to start mysql, as I guess this is a common issue with this, but it just gave a generic error.

I went through troubleshooting the mysql.sock file and everything, changing its permissions, but nothing is working.

I have rebooted my NAS many times.

I eventually tried to restart mysql. In doing so I get:

ERROR! MySQL manager or server PID file could not be found!

I can't find anything specific to the QNAP or any general type troubleshooting for this. Everything I find seems to be OSX related.

tshepang

11.7k21 gold badges90 silver badges134 bronze badges

asked Jul 2, 2013 at 11:50

2

After a lot of searching, I was able to fix the "PID file cannot be found" issue on my machine. I'm on OS X 10.9.3 and installed mysql via Homebrew.

First, I found my PID file here:

/usr/local/var/mysql/{username}.pid

Next, I located my my.cnf file here:

/usr/local/Cellar/mysql/5.6.19/my.cnf

Finally, I added this line to the bottom of my.cnf:

pid-file = /usr/local/var/mysql/{username}.pid

Hopefully this works for someone else, and saves you a headache! Don't forget to replace {username} with your machine's name (jeffs-air-2 in my case).

answered Jul 9, 2014 at 23:31

Error mysql server pid file could not be found

jeffwtribblejeffwtribble

1,1211 gold badge9 silver badges6 bronze badges

5

If you have installed MySQL using brew the best way to go would be with homebrew

brew services restart mysql

after you run that command, all the problems that the update generated will be resolved

answered Oct 31, 2016 at 19:18

Alvaro MenaAlvaro Mena

3993 silver badges2 bronze badges

3

I ended up figuring this out on my own.

In searching for my logs I went into

cd /usr/local/mysql/var

In there I found the file named [MyNAS].pid (replace [MyNAS] with the name of your NAS.

I then ran the following to remove the file

rm -rf /usr/local/mysql/var/[MyNAS].pid

I then restarted mysql

[/usr/local/mysql/var] # /etc/init.d/mysqld.sh restart        
/mnt/ext/opt/mysql
/mnt/ext/opt/mysql
Try to shutting down MySQL
ERROR! MySQL manager or server PID file could not be found!
/mnt/ext/opt/mysql
Starting MySQL. SUCCESS! 

I tested everything and it all works like a charm again!

answered Jul 2, 2013 at 21:41

adprocasadprocas

1,8431 gold badge14 silver badges29 bronze badges

Run the below commands and it will work.

Go to terminal and type

sudo chown -RL root:mysql /usr/local/mysql

sudo chown -RL mysql:mysql /usr/local/mysql/data

sudo /usr/local/mysql/support-files/mysql.server start

Error mysql server pid file could not be found

answered Apr 8, 2017 at 6:48

ShabeerShabeer

491 silver badge2 bronze badges

1

Just run mysqld (don't run as root) from your terminal. Your mysql server will restart and reset everything like shown in the picture below:

Error mysql server pid file could not be found

And use a command like so:

mysql -u root -h 127.0.0.1

Error mysql server pid file could not be found

answered Aug 9, 2016 at 17:28

ERROR! MySQL server PID file could not be found!

This might be due to issues with disk space, disk inode usage or innodb corruption which may lead to the error.

The issue was with the pid file and the solution was:

  1. SSH login to server as a root

  2. Create directory /var/run/mysql

mkdir /var/run/mysql

3) Create a file with name as mysqld.pid

touch mysqld.pid

  1. Change its ownership and group to mysql:mysql

    chown mysql:mysql mysqld.pid

  2. Restart MySQL service

Done!

answered Oct 16, 2017 at 5:35

0

I had the same issue. It turns out I added incorrect variables to the my.cnf file. Once I removed them and restarted mysql started with no issue.

answered Aug 9, 2014 at 6:04

Check if your server is full first, thats a common reason (can't create the PID file because you have no space). Run this to check your disk usage..

df -h

If you get something like this, you are full..

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   40G  6.3M 100% /

In that case, you need to start looking for what to delete to make room, or add an additional drive to your server.

Dancrumb

25.4k10 gold badges68 silver badges128 bronze badges

answered Sep 29, 2017 at 12:37

Nothing of this worked for me. I tried everything and nothing worked.

I just did :

brew unlink mysql && brew install mariadb

My concern was if I would lost all the data, but luckily everything was there.

Hope it works for somebody else

answered Dec 15, 2019 at 0:57

Error mysql server pid file could not be found

Note: If you just want to stop MySQL server, this might be helpful. In my case, it kept on restarting as soon as I killed the process using PID. Also brew stop command didn't work as I installed without using homebrew. Then I went to mac system preferences and we have MySQL installed there. Just open it and stop the MySQL server and you're done. Here in the screenshot, you can find MySQL in bottom of system preferences.

Error mysql server pid file could not be found

answered Apr 13, 2020 at 8:00

I know this is an older post, but I ran into the ERROR! MySQL server PID file could not be found! when trying to start MySQL after making an update to my.cnf file. I did the following to resolve the issue:

  1. Deleted my experimental update to my.cnf

  2. Deleted the .net.pid and .net.err files.

delete /usr/local/var/mysql/****-MBP.airstreamcomm.net.*
  1. Ensured all MySQL processes are stopped.
ps -ax | grep mysql
kill ****
  1. Started MySQL server as normal.
mysql.server start

ggorlen

36.7k7 gold badges61 silver badges75 bronze badges

answered Aug 24, 2018 at 18:26

Error mysql server pid file could not be found

First find PID of mysql service

ps aux | grep mysql

Then, you have to kill process

 sudo kill 

After you again start mysql service

mysql.server start

answered Sep 24, 2018 at 6:38

Error mysql server pid file could not be found

Turan ZamanlıTuran Zamanlı

3,6981 gold badge14 silver badges20 bronze badges

After doing setup of PHPMyAdmin, I was also facing the same problem,

Error mysql server pid file could not be found

  • Then I just stopped the MYSQL server by going into System settings, and then started again, and it worked.

answered Jun 11, 2019 at 6:40

Error mysql server pid file could not be found

root@host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/host.pxx.com.pid).

root@host [~]# vim /etc/my.cnf
Add Line in my.cnf its working know
innodb_file_per_table=1
innodb_force_recovery = 1

Result

root@host [~]# service mysql restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL……….. [ OK ]
root@host [~]# service mysql restart
Shutting down MySQL…. [ OK ]
Starting MySQL. [ OK ]

Source

Victor S.

2,0972 gold badges22 silver badges31 bronze badges

answered May 1, 2020 at 11:21

Error mysql server pid file could not be found

I have the same problem. I found the file {username}.local.err instead of {username}.local.pid inside /usr/local/mysql, then i changed the name *.err to *.pid and it works fine.
Starting MySQL. SUCCESS!

My OS El Capitan 10.11.5

answered Jun 10, 2016 at 3:59

phzaophzao

811 gold badge2 silver badges7 bronze badges

Error mysql server pid file could not be found

If you're using MySQL Workbench, the mysql.server stop/restart/start will not work.

You will need to login into the workbench and then click "shutdown server". See image attached.

Vikrant

5,35017 gold badges48 silver badges72 bronze badges

answered May 22, 2018 at 17:15

3

I was able to solve this on OS X by shutting down the existing mysql.server that was running:

mysql.server stop

The starting:

mysql.server start

From there I could run mysql.server restart without throwing the ERROR.

answered Apr 11, 2016 at 17:37

Error mysql server pid file could not be found

Kevin LearyKevin Leary

8,0452 gold badges51 silver badges44 bronze badges

2

How do I fix the MySQL pid file could not be found?

Solution.
Check for the parameter PID -file and create /var/run/mysqld/ Check where your PID -file points to. ... .
Change ownership of the MySQL folder. Change the ownership of the MySQL folder: sudo chown -R _mysql:_mysql mysql..
Change permissions of the MySQL folder. ... .
Change permissions of /usr/local/var..

What is pid file in MySQL?

The MySQL PID file is a process identification file that stores the Process ID number of the running MySQL instance. Each time you issue a command to mysql. server , MySQL would look for the PID file to find the Process ID and forward the command to the right process number.

How do I find my MySQL pid?

Login to DB; Run a command show full processlist; to get the process id with status and query itself which causes the database hanging; Select the process id and run a command KILL ; to kill that process.

What is pid file?

A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find out the pid of a running script.