Can mysqld process be killed? - mysql

I tried to kill mysql process since it was giving me an error as:
The server quit without updating PID file. But whenever I killed the process by PID, it created a new PID and the process persisted. Any explanation on this issue will be appreciated! The code I tried was as follows:
ps aux | grep mysql
sudo kill -9 [PID]
MySql was installed on Mac from .dmg file. And it was initially working fine, the error happens after it has already worked for a while.

have you tried to stop it using the daemon manager with service (linux):
service mysql stop
and for Mac:
sudo /usr/local/mysql/support-files/mysql.server stop
Hope it helps.

Related

ERROR! The server quit without updating PID file launching mysql.server start

I installed mysql 5.7.21 with brew on my HighSierra mac, but when I launch mysql.server start I get the error
Starting MySQL
... ERROR! The server quit without updating PID file (/usr/local/var/mysql/myMac.pid)
I followed this guide https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, and I also tried to solve the issue how described in all the posts on this argument:
I gave 777 permissions to mysql folder
I deleted the .err file with
sudo rm /usr/local/var/mysql/myMac.err
I created the .pid file with
sudo nano /usr/local/var/mysql/myMac.pid
I tried every step of this post PID error on mysql.server start?
but nothing worked.
I've already completely unistalled mysql several times after the first vain time, also without brew, but nothing changed.
Do you please have any idea?

Unable to stop MySQL on OS X 10.10

I'm starting to go nuts over this.
I setup MySQL/Apache/PHP using the tutorial by Coolest Guides On The Planet.
I'm guessing something went wrong as its not working as expected so I want to uninstall and try again.
The trouble is that I can't stop MySQL either by system preferences or command line. I keep trying suggestions on the net but so far unsuccessful.
Can anyone help?
Finally got around the autostart - Thanks to all who contributed and allowed me to see the way.
To stop the auto start I used:
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysql.plist
And to kill the service I used:
sudo pkill mysqld
This is what worked for me. It was listed under a different plist name:
sudo launchctl unload -w com.oracle.oss.mysql.mysqld.plist
For Mac Users
kill -9 {pid} kept restarting the process. This was because I had MySQL Server running. On OSX I had to:
1- System Preferences.
2- Search for mysql.
3- Press the Stop MySQL Server button.
got it from a github issue, and it solved my problem
https://github.com/docker/compose/issues/4950#issuecomment-407145733
brew services stop mysql#5.6 worked for me, when all else failed.
I also got the same problem, unable to stop MySql Sever through system preferences on macOS High Sierra.
I did brew uninstall mysql on my terminal window.
now I am able stop stop MySql Sever through system preferences.
Since mysql was installed on my mac 2 ways binary as well as home brew.
in terminal
kill `pgrep mysqld`
this kills the mysqld process.
If you used brew then you can find out which version you are using by:
launchctl list|grep mysql
this will print something like
92555 0 homebrew.mxcl.mysql#5.7
In my case I'm using mysql#5.7
You can stop using:
brew services stop mysql#5.7
Try with issuing the following command in command line:
ps -xo pid,ppid,stat,command | grep mysqld
It will show you your processes, with their parent ID in the second column. Look for the mysqld and it's parent process. After locating it, issue a:
sudo kill pid
where pid is mysqld's parent process ID.
EDIT
If you want to stop the process from launching again, try:
sudo launchctl unload /System/Library/LaunchDaemons/mysqld.plist
I've installed mysql via homebrew, but stop mysql by using mysql stop command, mysql restart right now.
try to execute command as follow if your mysql was installed via homebrew
brew services stop $(brew list | grep mysql)

ERROR! The server quit without updating PID file XAMPP

I know there are a lot of similar problems, but I have to post this because I am not finding a solution yet. Below is what happens when I try to run mysql. Not using homebrew here! I originally fixed the problem by killing the process ID for mysqld, but since I shut my computer down and relocated, then restarted, I am getting this error again. It seems to be the same except the difference with this error is the local.pid part. This was not in my original error message and wandering how to fix this?
Original error fixed by killing the process ID:
ERROR! The server quit without updating PID file (/Applications/XAMPP/xamppfiles/var/mysql/genevieve-ouellons-macbook-pro.pid)
The new error after shutdown, relocate and trying to start:
genevieve-ouellons-macbook-pro:bin genevieveouellon$ cd /Applications/XAMPP/xamppfiles/bin
genevieve-ouellons-macbook-pro:bin genevieveouellon$ ./mysql.server start
Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored
Starting MySQL
. ERROR! The server quit without updating PID file (/Applications/XAMPP/xamppfiles/var/mysql/genevieve-ouellons-macbook-pro.local.pid).
Anyone have this problem?
Thanks
It worked by using these two commands:
cd /Applications/XAMPP/xamppfiles/bin
sudo ./mysql.server start
Using sudo is the keyword that made the difference this time around.
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Above command worked in my case, only if the port is empty..
If this results error, restart server/mac and try the above command.. Hope this helps for someone..
Might've been deleted when you manually restarted mysql or renamed your machine. Not sure about XAMPP but when using mysql on OSX this is my go-to..
cd into /Applications/XAMPP/xamppfiles/var/mysql/
rm -rf *.local.err (deletes file)
touch YOURUSERNAME.local.pid (generates *.local.pid file the error thrown was complaining about)
cd back into your project and restart mysql using mysql.server start
Finally solved this issue... (3 days later)
Open up YOURUSERNAME.local.err in /Applications/XAMPP/xamppfiles/var/mysql/ with a text editor.
I had "InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files"
Then follow instructions on http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html as it states in the log file
Add innodb_force_recovery = 2 after line: [mysqld] to your my.cnf located in /XAMPP/xamppfiles/etc/
Then sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
Give it a minute and it should repair itself
Comment out with #innodb_foce_recovery = 2 in my.cnf
Unfortunately none of possible solutions did not helped me.
Still the Mysql was not able to start and in terminal I saw only /Applications/XAMPP/xamppfiles/var/mysql/: "ERROR!" without any further info
I simply reinstalled XAMPP again - worked

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

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.
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).
I tried everything above, but saw no results until I got a hint from here: https://superuser.com/questions/159486/how-to-kill-process-in-mac-os-x-and-not-have-it-restart-on-its-own
I eventually went over to the activity monitor in my Mac, force Quit the PID, and ran the command:
sudo /usr/local/mysql/support-files/mysql.server restart
The magic was done!!!
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
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!
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
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
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!
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.
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.
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
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.
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
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
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.
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
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
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.
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.

Why do I get "MySQL is not running but lock exists"?

I am getting this error
mysql is not running but lock exist
when I am checking the status of MySQL server. I have removed the lock files using following command:
rm /var/lock/subsys/mysql
but still I am getting same error.
Can anyone provide any input on this.
try using the unix lsof command to see which program has the lock
lsof | grep mysql
EDIT:in fact, run lsof on the lock itself
lsof /var/lock/subsys/mysql
I had the same error. It started after an unexpected server reboot. I saw there is a default /etc/my.cnf file which is not in use for my installation. The issue resolved when it renamed my.cnf as my.cnf_old
For this similar error:
service mysql status ERROR! MySQL is not running, but lock file
(/var/lock/subsys/mysql) exists
Follow these steps:
rm /var/lock/subsys/mysql rm:
remove regular empty file
/var/lock/subsys/mysql? y
Press y
/etc/init.d/mysql start.
If the error occurs again after starting MYSQL
then execute ps -ef | grep mysql
Kill all processes of MySQL and repeat steps 1 & 2.
I know this post is a quite old, but I like to make notes on the ones that work for issue that I've experienced recently. I was getting the following message, which lead me here:
service mysql status ERROR! MySQL is not running, but lock file
(/var/lock/subsys/mysql) exists
These are the steps that fixed my issues:
mv /etc/my.cnf /etc/my.cnf_old
rm /var/lock/subsys/mysql
/etc/init.d/mysql start
Starting MySQL.210921 16:46:28 mysqld_safe Logging to '/var/lib/mysql/server001.err'.
210921 16:46:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql. SUCCESS!