ERROR! The server quit without updating PID file on El captian - mysql

I have problem mysql starting, i was update to El captian on mac.
In terminal,
brew install mysql
mysql.server start
but it not working
this is error message.
Starting MySQL... ERROR! The server quit without updating PID file(/usr/local/var/mysql/Heo-MacBook-Pro.local.pid).
help me please!

I had the same problem using brew command to start mysql service.
If you are using MacOS, go to System Preferences and click on MySQL icon. Probably you'll see information message about permission denied in some directories. All you need to do is to give permission to that.
That's worked for me.
Open your terminal
Execute this command: sudo chown -R mysql /usr/local/mysql/data

Try this first:
/usr/local/var/mysql/support-files/mysql.server restart
If that doesn’t fix
Remove or backup the /etc/my.cnf
also try this method:
sudo /usr/local/var/mysql/support-files/mysql.server start
Starting MySQL
. ERROR! ....................
remove the .err files like so:
rm *.err /usr/local/var/mysql/data/

Solution working for my case:
Check your error log at /usr/local/var/mysql/Heo-MacBook-Pro.local.err
If there is something like this in the log: ...[Note] Unable to delete pid file: Permission denied..., which means mysql does not have the permission to your mysql folder
Use the following command in terminal to grant the permission: sudo chown -R mysql /usr/local/var/mysql/

The Problem could also be a version mismatch. My db was installed with Homebrew as version 5, later unintentionally upgraded to version 8.
Check the most recent error log at /usr/local/var/mysql/<your-computers-name.some.domain>.err
You can conveniently read the last couple of lines (e.g. 40) of the file with tail -n 40 <your-computers-name.some.domain>.err
You may find a hint about upgrading istructions in this case.

Related

Cannot find PID file after reinstall of mysql

I was getting an error that server quit without updating pid file. So I thought I would uninstall it and install it again.
I had installed it with homebrew last time so I did:
brew uninstall mysql
and to install it I did:
brew install mysql
Even after this however, I am still getting the same error.
$ mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Tirths-MBP.fios-router.home.pid).
If this mysql like a linux binaries; Try to regen PID with mysqld_safe as :
stop server
bin>$./mysql.server stop
regen PID file :
bin>$./mysqld_safe -u youruser&
then try to start mysql as :
bin>$./mysql.server start
p.s.
...and do you have etc/my.cnf file gen-ed ? It would be more helpful you to provide logs;
Hope this helps; Report your results please;

MySQL error: "The server quit without updating PID file"

I know this is a widelly answered question but I cannot find one solution that apply to my case.
On OSX El Capitan, I recently switched from a MAMP install to a "manual" install of MySQL, using the dmg package (version 5.7.11).
Now I want to modify the datadir to a custom location ; it used to work but I stopped the server and it doesn't want to start anymore. I tried launching it using:
sudo mysql.server start
sudo mysqld_safe
...but I always get this error: The server quit without updating PID file (/Users/xxx/Documents/dev/MySQL/data/xxx.pid). But it starts whan I set back the datadir to its original location! (which is /usr/local/mysql/data)
First time I had this issue it was clearly documented in the .err file (error 13 if I remember well, which is an access problem) and it was fixed by the magic combination of sudo chown -R _mysql:wheel data/ and sudo chmod -R 777 data/. Now both original and custom datadir have the same owners (user and group) and same read/write permissions. But server will start for one and not for the other? And the .err file only logs:
mysqld_safe Starting mysqld daemon with databases from /Users/xxx/Documents/dev/MySQL/data
mysqld_safe mysqld from pid file /Users/xxx/Documents/dev/MySQL/data/xxx.pid ended
Which doesn't helps me much.
Any ideas please?

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.

Not able to get mysql running on my mac

I'm trying to install mysql on my mac but unable to start server. When I try to start mysql server, I get this error in the logs: Can't start server: can't create PID file: Permission denied. Can't create/write to file ~/Downloads/mysql-5.5.32-osx10.6-x86_64/data/HOSTNAME.pid. I have symlinked /usr/local/mysql to ~/Downloads/mysql-5.5.32-osx10.6-x86_64. And all files/directories under /usr/local/mysql and ~/Downloads/mysql-5.5.32-osx10.6-x86_64 are owned by mysql. I'm trying start mysql server as root. Searched everywhere for this, but no luck. I tried with mysql 5.5 and 5.6. Same problem with both the versions. Any clues?
I'd highly recommend you install mysql using Homebrew. To do this:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew install mysql
The output of the second command may give you a few extra steps. Follow them and you should be set.
You have to start it as an administrator. Write sudo and a space followed by the command you will use to start MySQL.
Use below permission to grant permissions:
check your mysqld location, mine is this:
do this:
ls -ld /usr/local/var/mysql
sudo chmod a+w /usr/local/var/mysql

After MySQL install via Brew, I get the error - The server quit without updating PID file

Ok, I've searched all over and have spent quite a bit of my time installing, uninstalling, trying various option but without success.
I'm on Mac OS X Lion (10.7.3) and am trying to setup a Python, MySQL.
I successfully installed Python and MySQL via HomeBrew.
Python works great.
After MySQL Installation, I followed the first 2 steps - unset and the mysql_install_db commands.
Now, when I try to start mysql "mysql.server start", I get the following error
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Brajeshwar.local.pid).
Brajeshwar is my username on my machine.
I found that it was a permissions issue with the mysql folder.
chmod -R 777 /usr/local/var/mysql/
solved it for me.
EDIT 2012/09/18:
As pointed out by Kane, make sure the mysql database is properly set up before doing anything else. See “PID error on mysql.server start?” for more info.
Original answer kept for history's sake:
It most likely is a permissions issue. Check /usr/local/var/mysql/*.err. Mine said:
120314 16:30:14 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
120314 16:30:14 mysqld_safe mysqld from pid file /usr/local/var/mysql/janmoesen.local.pid ended
I also had to do this:
sudo chown _mysql /usr/local/var/mysql/*
I ended up with completely reinstalling of mysql, and it finally worked out.
WARNING This will remove all of your databases, so make sure to save dumps first.
brew remove mysql
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql
brew install mysql
mysqld --initialize --explicit_defaults_for_timestamp
mysql.server start # no sudo!
I had this issue on mac 10.10.5 Yosemite
What I did to solve this
cd /usr/local/var/mysql
sudo rm *.err && sudo rm *.pid
sudo reboot
sudo mysql.server start
I had the same issue on OS X El Capitan, here's the terminal command sequence that fixed it for me.
Delete error files (you'll have to change the path depending on your setup)
sudo rm /usr/local/mysql/data/*.err
Find the info for the mysql process that's still running and kill it:
ps -A | grep -m1 mysql | awk '{print $1}' | sudo xargs kill -9
Now restart MySQL:
/usr/local/mysql/support-files/mysql.server start
November, 2014: If you're getting this error on MySQL 5.6.x on Mac OS X Mavericks or Yosemite and want to use MySQL with PHP locally (/tmp/mysql.sock is where PHP PDO expects to find the sock file), here is what fixed it for me:
1) Uncomment the default homebrew config file lines and edit as below
$ sudo vi /usr/local/Cellar/mysql/5.6.21/my.cnf
...
basedir = /usr/local/Cellar/mysql/5.6.21
datadir = /usr/local/var/mysql
port = 3306
server_id = <UNIQUE_NUMBER_HERE_OR_LEAVE_COMMENTED_OUT>
socket = /tmp/mysql.sock
pid-file = /usr/local/var/mysql/[BOXNAME].local.pid
....
BOXNAME is what you have in your System Prefs -> Network as the unique id for your computer on the network.
2) Set permissions on all the files in the mysql datadir. These were all owned by [my_username]. MySQL is very picky about this and refuses to create the pid file unless it (the user _mysql) owns the directory.
$ sudo chown -R _mysql:mysql /usr/local/var/mysql
3) Start MySQL using the bash helper/wrapper script:
$ sudo mysql.server start
Starting MySQL
. SUCCESS!
Hope that helps. If the above doesn't work for you, try to run the mysqld_safe binary manually in the Cellar/mysql/VERSION_/bin/ directory and check what the settings are (if it runs)
sudo /usr/local/Cellar/mysql/5.6.12/bin/mysqld_safe &
If that runs, you can
ps aux | grep mysql
and see something like
[username] 6881 0.0 2.7 3081392 454836 ?? S 8:52AM 0:00.54 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --verbose --log-error=/usr/local/var/mysql/BOXNAME.local.err --pid-file=/usr/local/var/mysql/BOXNAME.local.pid
I'm not sure why that worked for me but it shows you where I got the my.cnf config file options from. You can also use the command line options to try to troubleshoot when starting mysqld manually.
If you do run manage to run MySQL server using mysqld_safe, you may have to do this to shut it down before trying the mysql.server bash helper. Resist the urge to kill -9 [PID] because you can corrupt your data.
mysqladmin -uroot shutdown
Good luck!
This worked for me:
sudo chmod -R 777 /usr/local/var/mysql/
sudo /usr/local/mysql/support-files/mysql.server start
This worked for me on 10.12.2 :
$ rm /usr/local/var/mysql/*.err
then
$ brew services restart mysql
If I remember correctly it is a permissions issue. Try to 'touch' and 'chmod' the pid file or the folder the file is held in.
My issue was that I started server as sudo once and then tried to restart as a local user.
Here mysql was not able to write to '.err' file owned by root.
I had to remove that file and restart the server:
sudo rm /usr/local/var/mysql/*.err
mysql.server start
Try this (OSX)
Step 1:
ps -aux | grep mysql
Then kill the 4 digits PID number
Step 2: kill 1965
Step 3: mysql.server start
Or having hard time to locate those PID numbers, try this below
Step 1 again: ps -aux | grep mysql
Step 2 again: killall
Step 3 again: mysql.server start
I’ve got a similar problem with MySQL on a Mac (Mac Os X Could not startup MySQL Server. Reason: 255 and also “ERROR! The server quit without updating PID file”). After a long trial and error process, finally in order to restore the file permissions, I’ve just do that:
launch the Disk Utilities.app
choose my drive on the left panel
click on the “Repair disk permissions” button
This did the trick for me. Hoping this can help someone else.
Find usr/local/var/mysql/your_computer_name.local.err file and understand the more information about error
Location : /usr/local/var/mysql/your_computer_name.local.err
It's probably problem with permissions
Find if mysql is running and kill it
ps -ef | grep mysql
kill -9 PID
where PID is second column value
2. check ownership of mysql
ls -laF /usr/local/var/mysql/
if it is owned by root, change it mysql or your user name

sudo chown -R mysql /usr/local/var/mysql/
For me it worked with:
unset TMPDIR
mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
What worked for me was:
Go to your mysql installation directory
sudo chmod -R 777 data
Then go back one directory
cd support-files/
sudo ./mysql.server start
After that the server started running.
But the problem with this method is that I have to repeat this every time I want to start the mysql now. Don't know why it started behaving like this suddenly.
I had this problem on Linux, but the cause is relevant to any mysql installation. In my case, the server was crashing before startup was complete and the pid file updated. The error messages were seen when starting up mysqld directly instead of via "service mysql start".
In my case, the cause was the partition where the log files were located being full. Removing log files permitted mysql to start again. To test for this issue, go to the location of your mysql activity logs, and do df ..
If you have upgraded your mysql installation to 8.x, check if your previous version is supported for upgradation.
If not, mysql will not work! Uninstall your mysql along with all configuration files in /usr/local/var/mysql (remove the whole folder). Reinstall mysql.
NOTE: reinstalling might lead to loss of data.
Please check the log , you will get more detailed information .
Use the below command to tail the error log
tail -100 /usr/local/var/mysql/<user_name>.local.err
For me , one of the directory is missing , once created the server has started .
The key takeaway is to check the .err file, by default on Mac OSX it's in /usr/local/var/mysql.
That log filed revealed to me that I had to delete the following files:
ibdata1
ib_logfile0
ib_logfile1
Running MySQL with mysql.start worked successfully after that. Note that deleting those files will likely causes data loss.
sudo chmod -R 777 /usr/local/var/mysql/
works for me.
I had the same issue:
But the situation was, every time i try to enter:
/usr/local/mysql/support-files/mysql.server start
a file named localhost.pid is created instead of iMax0.local.pid which was stated in the error:
ERROR! The server quit without updating PID file (/usr/local/mysql/data/iMax0.local.pid).
Solution that works for me was copying localhost.pid and renaming it to iMax0.local.pid.
My solution on OSX El Capitan was:
sudo chmod ugo+w /tmp
It was broken suddenly.
The error was:
ERROR! The server quit without updating PID file
and the log showed:
Can't start server : Bind on unix socket: Permission denied
It might also be helpful to note, that under OSX there is no my.cnf file by default and not needed by default, which I did not know. Good luck!
$ sudo mysql.server restart
It works for me.
I had the similar issue. But the following commands saved me.
cd /usr/local/Cellar
sudo chown _mysql mysql
This is file permission problem.
Check disk permissions and repair.
Osx => Cmd+Space => Disk Utilty => Verify Disk Permissions.
Verify completed after Repair Disk Permissions.
mysql.server start command is worked succesfuly.
None of the answers worked for me. However, I simply did sudo mysql.server start and it worked nicely.
Also, for me, it did NOT show permissions issue in *.err file.
all solutions above doesn't work for me.
but they give me some clues to fix this error.
mysql.server start ----error The server quit without updating PID file
I installed mysql#5.7 on my macbook mojave with homebrew
brew install mysql#5.7
mysql error log located in /usr/local/var/mysql/IU.lan.err,there is one line in it:
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
after trying many posts in goole search engine,I turned to baidu
https://blog.csdn.net/xhool/article/details/52398042
inspired by this post,I found the solution:
rm /usr/local/var/mysql/*
mysqld --initialize
a random password for root user will be shown in bash.
but the command mysql -uroot -p[theRandomPassword] cant work.so I have to reset password.
create a init file with contents like this
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
place it in any directory easy to find,such as Desktop
mysqld --init-file=[YourInitFile] &
many logs printed on your screen.
mysql -uroot -pMyNewPass
enjoy your high-version mysql!
Happened to me because I was actually switching from MariaDB to Mysql.
Switching back to MariaDB solved this.
I'm guessing the existing database wasn't compatible.
Solved this using sudo chown -R _mysql:_mysql /usr/local/var/mysql
Thanks to Matteo Alessani
This error may be actually being show because mysql is already started. Try to see the current status by:
mysql.server status