Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL server startup error 'The server quit without updating PID file'

Tags:

mysql

On Mac OS X v10.6 (Snow Leopard), starting MySQL gives the following error:

The server quit without updating PID file

File my.cnf

[mysqld] port            = 3306  socket          = /tmp/mysql.sock  skip-external-locking  key_buffer_size = 16K  pid-file=/var/run/mysqld/mysqld.pid  [mysqld_safe]  log-error=/var/log/mysqld.log  pid-file=/var/run/mysqld/mysqld.pid 
like image 900
Chinmay Avatar asked Feb 10 '11 21:02

Chinmay


People also ask

Where to find PID file for MySQL?

pid in the /usr/local/mysql/data/ directory.

Can't connect to local MySQL server?

normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.

Can't connect to local MySQL server through socket Centos?

You could try using "127.0. 0.1" if the socket connector is not enabled/working. In that case, you should probably check if your MYSQL server is actually running. You can also force using a socket with the socket parameter (-S with /usr/bin/mysql) and force TCP/IP by providing a port (-P with /usr/bin/mysql.)


2 Answers

Try to find your log file with suffix ".err". There should be more information. It might be in:

/usr/local/var/mysql/your_computer_name.local.err 

It's probably a problem with permissions

  1. Check if any MySQL instance is running

    ps -ef | grep mysql 

    If yes, you should stop it, or kill the process:

    kill -9 PID 

    where PID is the number displayed next to the username on the output of the previous command

  2. Check ownership of /usr/local/var/mysql/

    ls -laF /usr/local/var/mysql/ 

    If it is owner by root, you should change it to mysql or your_user

    sudo chown -R mysql /usr/local/var/mysql/ 
like image 119
Tombart Avatar answered Oct 15 '22 22:10

Tombart


Follow the instructions from brew install mysql.

Set up databases to run as your user account with:

For MySQL 5.x:

unset TMPDIR mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp 

To set up base tables in another folder, or use a different user to run mysqld, view the help for mysqld_install_db:

mysql_install_db --help 

And view the MySQL documentation:

  • 4.4.3 mysql_install_db — Initialize MySQL Data Directory
  • 2.10.4 Securing the Initial MySQL Accounts

For MySQL 8.x:

unset TMPDIR mysqld --initialize-insecure --log-error-verbosity --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp 

Make sure the data directory /usr/local/var/mysql above is empty. Back it up if necessary.

To run as, for instance, user "mysql", you may need to sudo:

sudo mysql_install_db ...options... 

Start mysqld manually with:

mysql.server start 

Note: if this fails, you probably forgot to run the first two steps up above

like image 21
svs Avatar answered Oct 15 '22 20:10

svs