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.9k21 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
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,8531 gold badge14 silver badges31 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
answered Apr 8, 2017 at 6:48
ShabeerShabeer
591 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:
And use a command like so:
mysql -u root -h 127.0.0.1
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:
-
SSH login to server as a root
-
Create directory /var/run/mysql
mkdir /var/run/mysql
3) Create a file with name as mysqld.pid
touch mysqld.pid
-
Change its ownership and group to mysql:mysql
chown mysql:mysql mysqld.pid
-
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
26k10 gold badges72 silver badges129 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
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.
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:
-
Deleted my experimental update to
my.cnf
-
Deleted the
.net.pid
and.net.err
files.
delete /usr/local/var/mysql/**<YourUserName>**-MBP.airstreamcomm.net.*
- Ensured all MySQL processes are stopped.
ps -ax | grep mysql
kill **<process id>**
- Started MySQL server as normal.
mysql.server start
ggorlen
40k7 gold badges66 silver badges89 bronze badges
answered Aug 24, 2018 at 18:26
First find PID of mysql service
ps aux | grep mysql
Then, you have to kill process
sudo kill <pid>
After you again start mysql service
mysql.server start
answered Sep 24, 2018 at 6:38
Turan ZamanlıTuran Zamanlı
3,7581 gold badge15 silver badges21 bronze badges
After doing setup of PHPMyAdmin, I was also facing the same problem,
- 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
hardik chughhardik chugh
1,01414 silver badges12 bronze badges
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,3213 gold badges22 silver badges33 bronze badges
answered May 1, 2020 at 11:21
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 badges8 bronze badges
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,42017 gold badges49 silver badges73 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
Kevinleary.netKevinleary.net
8,4612 gold badges51 silver badges44 bronze badges
2
When running mysql.server
related commands in your MySQL installation, you may encounter a PID file could not be found
error.
The following example shows how the error appears when I ran the mysql.server stop
command:
$ mysql.server status
ERROR! MySQL server PID file could not be found!
The PID file could not be found error is usually caused by two things:
- MySQL server is not running, so no PID file was found
- A mismatch between the running MySQL instance PID file location and the
mysql.server
command target location
This tutorial will help you understand both causes and how to fix them
MySQL server is not running, so no PID file was found
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.
When you start the MySQL server, the PID file is automatically generated by MySQL. When you want to stop the server, then MySQL needs to find the file to terminate the right PID from your computer.
When you run the mysql.server stop
command when there’s no running MySQL instance, the response would be there’s no PID file found:
$ mysql.server stop
ERROR! MySQL server PID file could not be found!
This is why before attempting any other fix, you should make sure that the MySQL instance is running on your computer.
Depending on how you installed MySQL on your computer, you can use one of the following commands to start MySQL services:
mysql.service start
— for MySQL installed using package managersbrew services start mysql
— for MySQL installed with Homebrew- Using the preference pane for macOS official MySQL installation
- Using the control panel for XAMPP, MAMP, or WAMP
- Run the Windows service for MySQL from the services panel
Once you make sure that MySQL server is running, you can try the command that produces the PID file error.
If the error still appears, then it’s possible the PID file mismatch occurs on your computer. Let’s learn how to fix that next.
A MySQL service can be started from many ways: you can run the service from the Terminal or from a UI panel.
Each time you start MySQL service, the PID file is generated in a specific location depending on the configuration MySQL used.
The PID file location mismatch happens when you generate a PID file on one location, but the command you currently run seeks the PID file on another location.
In my local MySQL server, I started MySQL server using the MySQL Preference Pane that comes bundled with MySQL server installation file for Mac:
When I started the server using the Preference Pane, MySQL generates a PID file named mysqld.local.pid
in the /usr/local/mysql/data/
directory.
When I tried to stop the server using mysql.server stop
command, MySQL tries to find the nts-mac.pid
file, which is generated if MySQL is started from the Terminal using mysql.server start
command (nts-mac
is the name of my Mac computer)
To fix the error, I needed to stop the currently running MySQL thread from the Preferences Pane before running the mysql.server start
command again.
You may not be using MySQL Preferences Pane, but it’s possible that you have a MySQL process running in your computer or Linux server that uses a different PID file name or location than the one your command is trying to find.
If you don’t know how to stop MySQL server, then you can try to run the ps -e | grep mysql
command from your terminal.
Here’s the output from my computer:
$ ps -e | grep mysql
24836 ttys001 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe
24920 ttys001 0:01.04 /usr/local/mysql/bin/mysqld
24946 ttys001 0:00.01 grep mysql
The result tells me that there are running mysqld
processes on my computer. If you found the same in your computer, then you need to kill the running process using one by one using the kill -9 <PID>
command.
The PID code number is the first number on the left, so in my case, they are 24836
and 24920
:
$ kill -9 24836
$ kill -9 24920
With that, there should be no running MySQL process on your computer. You can now try to start the MySQL server again:
$ mysql.server start
Starting MySQL
SUCCESS!
Now that MySQL server is started from the command line, stopping the server using mysql.server stop
shouldn’t cause any issue.
And those are the two ways you can fix MySQL server PID could not be found error.
If you still encounter the error, then you may need to reinstall your MySQL server. Please make sure that you save a backup of your MySQL database before you attempt to reinstall the program.
You can visit my tutorial on copying MySQL database to save a backup of your MySQL server.
I hope this tutorial helps you 👍
Hello everyone, I have one problem of my MySQL database. I am getting an error in the database stated “MySQL is running but PID file could not be found” and I have tried several process to fix it. Even I have tried to shutdown mysqladmin which also does not work. Finally I have to kill the process ID and I was lucky enough that my database is safe and it did not cause any issue. But still I am confused what to do and not getting any option to solve it. What to do, can anyone help me?
Well MySQL is one of the useful database which is used by many organization and it is a database software in the application world. It is used for many purpose and sometimes users has to work with its services and then restart the services for the changes which is made to see the effect. But while starting MySQL service, an error may occur which can disturb the entire database. The error states:
MySQL is running but PID file could not be found
This issue can be due to several unwanted things and even due to disk space, innodb corruption or may be disk inode.
Here the issue is with PID file and solution is mentioned:
SSH server as a root user
Then create a directory /var/run/mysql
Now create a file named as mysqld.pid
Then change its ownership and group to mysql:mysql
chown mysql:mysql mysqld.pid
At last restart the MySQL service and no errors will be seen.
If you are not satisfied with this process then you have to completely kill the process Id. For that you have to follow the steps provided:
First check whether /tmp partition is full. This happens when MySQL cannot write the /tmp partition to create a lock file.
Even there is a possibility that the /tmp partition is cleared and MySQL server is looking for PID file there. Therefore just create a new PID file and again restart the server.
By doing this the status is checked, even sometimes you can get an error message like:
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
Well this may be an instance, just remove the lock file and then restart the server.
rm /var/lock/subsys/mysql
When this does not work then you have to kill the current MySQL process from server by below mentioned steps:
With process ID you can get all process of MySQL. You need to kill PID for MySQL by the following command
At last restart MySQL service
The above steps mentioned are the ways to repair error! MySQL is not running, but PID file exists and this should be followed properly.
Automatic Way to Repair “MySQL Is Running But PID File Could Not Be Found”
After trying the above mentioned steps if still you are facing the same issue then you need to use third party tool like MySQL file Repair Tool which is one of the best tool for repairing MySQL database. It completely works to fix any type of error in MySQL and recovers the entire database.
This software can also save the retrieved information in Transact-SQL script which is fit for quick database recreation. And also it recovers table structure and data. It supports MySQL versions like 5.x, 4.x, 3.x, 2.x and 1.x and available for all modern platforms that includes windows 95/98/2000/XP/2003 server.
It has the ability to repair password protected SQL files smoothly. And most importantly it is very user friendly. So, you need to download this excellent program and follow its easy steps to fix error! MySQL server PID file could not be found! with ease.
Steps to repair corrupted MySQL table
Step 1: Start with Stellar Phoenix Database Repair for MySQL . Software and you can see the main interface as shown below.
Step 2: Click on ‘Select’ button & then select ‘Repair corrupt database which is stored at default location of MySQL’ option to select your database from default location and then click.
Step 3: The left pane shows the preview of database and its component in a tree like structure after completing scanning process.
Step 4: After previewing your database, to start repair process click ‘Repair’ button in file menu on the main user interface. Stellar Phoenix Database Repair for MySQL dialog box appears. Click Yes.
Step 5: After successful completion of the process, a message box is displayed as ‘repair process finished successfully’. Click ‘OK’ to close the message box.
Step 6: If you want to select the database manually then select ‘Manual selection of database to repair’ option & then click browse. Browse the folder dialog box opens. Select the folder that contains database and click ‘OK’.
Time To Conclude
I Hope, the aforementioned methods will help you to resolve ‘MySQL is running but PID file could not be found’ error and recovers table structure & data with ease. but if you want instant resolution to fix this error then you can try MySQL Repair Tool. This program will definitely allow you to repair your MySQL database and get back all the database in a hassle free manner.
Therefore, all the very best to you………
Jacob Martin is a technology enthusiast having experience of more than 4 years with great interest in database administration. He is expertise in related subjects like SQL database, Access, Oracle & others. Jacob has Master of Science (M.S) degree from the University of Dallas. He loves to write and provide solutions to people on database repair. Apart from this, he also loves to visit different countries in free time.
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
Getting frustrated with MySQL PID could not be found CentOS error?
This is a common problem that happens when we simply restart the MySQL server.
Also, the error is due to the existing PID doesn’t allow us to create a new PID.
At Bobcares, we often get requests to solve such MySQL errors as part of our Server Management Services.
Today, let’s analyze the causes and see how our Support Team fix it for our customers.
What is MySQL PID could not be found CentOS error?
Let’s first get an idea of the error as such. In any server, Process identifier, a PID is a unique number that identifies each running process. Every service running on the server will have a unique PID associated with it.
The MYSQL PID error occurs due to existing PID doesn’t allow to create new PID. So we kill the old PID and restart the MYSQL service. Usually, this error arises when we try to restart the MYSQL service.
Recently one of our customers contacted us with the MYSQL PID error. He tried to restart the MYSQL service and it returned the error as:
How we fix MySQL PID could not be found centos error?
So far, we discussed MySQL PID could not be found centos error. Now let’s see how our Support Engineers fix this error for our customers.
Solution 1
To fix this error Our Support Engineers follow the below steps.
Normally, the reason for the error is due to the existing PID not allowing us to create a new PID. So we kill the old PID and then start MySQL service.
1. Therefore, we first check the MySQL existing PID. So we use the below command.
ps -aufx | grep mysql
Normally, the sample result will appear like this,
[root@server ~]# ps -aufx | grep mysql
root 10075 0.0 0.0 61304 748 pts/0 S+ 00:31 0:00 _ grep mysql
mysql 4745 0.0 0.0 65948 1312 ? S Mar13 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/cent.pid
mysql 3546 0.0 2.1 288868 85376 ? Sl Mar13 198:35 _ /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/cent .err --pid-file=/var/lib/mysql/cent.pid
From this above result, we found two existing MYSQL PIDs. And follow the steps.
2. Next, we kill the process using the below command.
[root@server ~]# kill -9 4745
[root@server ~]# kill -9 3546
3. Then we start MySQL service.
[root@server ~]# /etc/init.d/mysqld start
Starting MySQL...... SUCCESS!
4. Next, we check the MySQL service Status.
[root@server ~]# /etc/init.d/mysqld status
SUCCESS! MySQL running (14346)
[root@server ~]#
The MySQL service has been restarted successfully
Solution 2
Sometimes, the 100% usage of a server partition also can cause an error. Here, we check for the /tmp partition is full or not. Also, this can happen when MySQL can’t write to the /tmp partition to create a lock file.
1. For that, we use the below command to check the storage of partition.
$ df -h
Also, in many cases, clearing the /tmp partition results in failure to fetch the MySQL PID file. So we just create the PID file and restart the service.
2. Therefore, we use the below command to create the PID file. After that, we restart the MYSQL service.
$ touch /tmp/mysql.sock
$ service mysqld restart
3. Next, we check the MYSQL status.
service mysqld status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
Similarly, when the error is with the lock file, we remove the lock file and restart the MYSQL service.
$rm /var/lock/subsys/mysql
$ service mysqld restart
4. Again, if we get an error like this:
$ service mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/mydomain.com.pid).
5. Then we check the log file:/var/lib/mysql/mydomain.com.err
$ tail /var/lib/mysql/mydomain.com.err
130506 14:44:07 mysqld_safe mysqld from pid file /var/lib/mysql/mydomain.com.pid ended
Here the error tells us that we have a compatibility problem with some of our tables and MySQL fails to start in safe mode.
6. Therefore, we change the way MySQL starts to work around this situation.
$ { echo “mysql_enable=”YES””; echo “mysql_args=”–skip-grant-tables –skip-networking””; } >> /etc/init/rc.conf
7. Again we start the MYSQL service successfully.
8. Then after, we try to upgrade the MYSQL service.
$ mysql_upgrade
[Need more assistance for MySQL PID could not be found CentOS error? We are available 24×7 to fix it for you.]
Conclusion
In short, the MySQL PID could not be found CentOS error occurs due to the existing PID not allowing us to create a new PID. Also, it is a common problem during the restart of the MYSQL server. Today, we saw how our Support Engineers fix this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
- HowTo
- MySQL Howtos
- MySQL Error Server PID File Could Not Be …
- MySQL PID File
- Fix MySQL
ERROR! MySQL server PID file could not be found!
in Linux
In this article, we will look into the ERROR! MySQL server PID file could not be found!
in MySQL, and its solutions with a sufficient explanation.
MySQL PID File
A file contains the process identification number or process ID of the running instance of MySQL, known as MySQL PID File. Whenever we use the mysql.server
command, MySQL uses the PID file to find the process ID
.
MySQL server generates the PID file automatically whenever the Server is started. The MySQL server finds the process ID
from the PID file to stop the right MySQL process.
If the PID file of MySQL does not exist, the server shows ERROR! MySQL server PID file could not be found!
.
Fix MySQL ERROR! MySQL server PID file could not be found!
in Linux
We can face ERROR! MySQL server PID file could not be found!
error if the MySQL process exits or gets killed abruptly. We can fix this error using the following steps.
-
Check the path of PID file in MySQL configuration file located either at
/etc/mysql/my.cnf
or at/etc/mysql/mysql.conf.d/mysqld.cnf
.If the
pid-file
parameter is not set in the configuration file, set thepid-file
path by adding the following line.pid-file = /var/run/mysqld/mysqld.pid
-
Create the following directories and set the permission as follows.
mkdir /var/run/mysqld touch /var/run/mysqld/mysqld.pid chown -R mysql:mysql /var/run/mysqld
-
Change the ownership on the
MySQL
directory and set permission using the following command.sudo chown -R _mysql:_mysql mysql sudo chmod 777 /usr/local/var/mysql
Related Article — MySQL Error
Starting and stopping the MySQL server via Preferences Pane/launchd and on the other hand via sudo /usr/local/mysql/support-files/mysql.server start/stop
are not really compatible.
After choosing «Launchd Support» in the MySQL installer the launch daemon com.oracle.oss.mysql.mysqld will be created and the MySQL preferences pane uses the launchd mechanism to start and stop mysql. If you enable «Automatically Start MySQL Server on startup», mysqld is enabled automatically after starting your Mac.
The pid file’s name created by the launch daemon is not compatible with the one created and expected by the mysql-server script.
The launch daemon’s pid file name created while running is mysql.local.pid, the script expects a name based on your Mac’s hostname, .local or computer name though.
So either use the MySQL pref pane/launchctl or the script to start and stop mysqld.
To some extent you can make both methods compatible by modifying the file com.oracle.oss.mysql.mysqld though:
After stopping mysql replace the array
<array>
<string>/usr/local/mysql/bin/mysqld</string>
<string>--user=_mysql</string>
<string>--basedir=/usr/local/mysql</string>
<string>--datadir=/usr/local/mysql/data</string>
<string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
<string>--log-error=/usr/local/mysql/data/mysql.local.err</string>
<string>--pid-file=/usr/local/mysql/data/mysql.local.pid</string>
</array>
by
<array>
<string>/usr/local/mysql/bin/mysqld</string>
<string>--user=_mysql</string>
<string>--basedir=/usr/local/mysql</string>
<string>--datadir=/usr/local/mysql/data</string>
<string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
<string>--log-error=/usr/local/mysql/data/$name.err</string>
<string>--pid-file=/usr/local/mysql/data/$name.pid</string>
</array>
with $name: either HostName (e.g. host.example.com), LocalHostName (e.g. host.local) or ComputerName (e.g. host). Probably the best is to use a hostname. You may get a hostname with hostname with scutil --get HostName
or set it with sudo scutil --set HostName your_hostname
.
You can also get the actually used mysql-server script pid’s name — after stopping the launch daemon and starting mysqld with mysql-server start
— by checking mysql’s data directory with sudo ls /usr/local/mysql/data
. Use the name found there to adjust the plist’s pid name.
You may have to convert the launch daemon file to xml to edit it. The app TextWrangler opens it as xml file immediately.
Reload the plist with launchctl afterwards.
Now should be able to start and stop with the MySQL pref pane and the mysql.server script.
If you have enabled «Automatically Start MySQL Server on Startup», you can’t stop the server – even after modifying the plist – with the script because launchd overrides any stop command after a few seconds and launches mysqld again.