This step-by-step guide is mainly for FreeBSD, however the idea is the same for Linux. Every once a while, when I update my FreeBSD box, the system likes to shutdown my MySQL server. Therefore, I need to start it again after the update is done. Unfortunately, the upgrade process is not smooth every time. Sometimes it will throw me some error.

/usr/local/etc/rc.d/mysql.server start

Oh well, I got the following error messages:

Starting MySQL..... ERROR! The server quit without updating PID file.

Sometimes, the message will tell you the exact location of which PID file:

Starting MySQL..... ERROR! The server quit without updating PID file (/var/db/mysql/www.icesquare.com.pid).

There are several solutions to troubleshoot these problems. I will go over each one by one.

Solution 1: Reboot The Computer

Although it sounds simple, but it really works. During the system upgrade, the OS may disable some of your daemons. Instead of troubleshooting each one by one, the easiest way is to start everything over. For example, I experienced this problem today after upgrading the Apache and Ruby (Yes, MySQL is not part of the update), and I got this error message afterward. After rebooting the computer, the error message is gone.

Solution 2: Remove Your MySQL Config File

If you have modified your MySQL configuration file, MySQL may not like it few versions after (MySQL is not backward compatibility friendly). It can be the problem of using an unsupported variable, or something similar. The easiest way is to remove your configuration file, and try to start the MySQL server again:

Backup your MySQL configuration first.

mv /etc/my.cnf /etc/my.cnf.backup

And restart the MySQL server again:

/usr/local/share/mysql/mysql.server start

Hopefully you will see the following message:

Starting MySQL. SUCCESS!

Solution 3: Upgrade Your Database File

Sometimes, the newer MySQL doesn’t like the database created in earlier version. I discovered this when I upgrade to MySQL 5.5.7:

Starting MySQL..... ERROR! The server quit without updating PID file (/var/db/mysql/www.icesquare.com.pid).

Since MySQL tells me which PID file causes the problem, I open the file and take a look what’s going on:

sudo tail /var/db/mysql/www.icesquare.com.err

And I saw something interesting: tables: Table ‘mysql.proxies_priv’ doesn’t exist:

101112 10:49:16  InnoDB: Initializing buffer pool, size = 128.0M
101112 10:49:16  InnoDB: Completed initialization of buffer pool
101112 10:49:16  InnoDB: highest supported file format is Barracuda.
101112 10:49:17  InnoDB: 1.1.3 started; log sequence number 1589404
101112 10:49:17 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.proxies_priv' doesn't exist
101112 10:49:17 mysqld_safe mysqld from pid file /var/db/mysql/www.icesquare.com.pid ended

The reason is very simple. MySQL could not open a table created in the earlier version (< 5.7.7) because it is not compatible with the current version. So, we can try to start the MySQL in safe mode through rc.d. First, you can edit the /etc/rc.conf and put the following into the file:

mysql_enable="YES"
mysql_args="--skip-grant-tables --skip-networking"

Restart MySQL through rc.d:

/usr/local/etc/rc.d/mysql-server start

If you did it right, you should see something like the following:

Starting MySQL.. SUCCESS!

Now, MySQL is already running the safe-mode. We want to perform a MySQL upgrade on all tables:

sudo mysql_upgrade

You should see something like this:

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
OK

Now, we want to switch the MySQL back to normal mode by commenting the extra options in /etc/rc.conf:

mysql_enable="YES"
#mysql_args="--skip-grant-tables --skip-networking"

And restart MySQL through /etc/rc.d:

/usr/local/etc/rc.d/mysql-server restart

Now the MySQL is up and running again!

Happy MySQLing.

–Derrick

Our sponsors:

24 Responses to “MySQL: Starting MySQL….. ERROR! The server quit without updating PID file”

  1. Extremely helpful post. I had the exact same problem and this is the only Google result that seemed to deal with the problem directly. Fantastic post.

  2. Thank you! Glad to know that it works for you!

  3. Very helpful indeed. Thank you.

  4. Thanks a bunch dude, saved my day!

  5. Hi, doing the same and … not working ^^

    FreeBSD 8.0-STABLE x64
    upgrading from mysql 5.5.6 to 5.5.7

    ok, i’ve upgraded, stop server, restart with skip grant tables (and network) tried to upgrade and … crash.

    ( .. all tables pass OK …)
    Running ‘mysql_fix_privilege_tables’…
    ERROR 1146 (42S02) at line 1127: Table ‘mysql.proxies_priv’ doesn’t exist
    FATAL ERROR: Upgrade failed

    any ideas ?

  6. i’ve found the solution in mysql sources

    CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT ” NOT NULL, User char(16) binary DEFAULT ” NOT NULL, Proxied_host char(60) binary DEFAULT ” NOT NULL, Proxied_user char(16) binary DEFAULT ” NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT ” NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment=’User proxy privileges';

    mysql_upgrade work fine after that … dunno why this table wasn’t created.

  7. That’s very interesting. I’ve never thought about a system table doesn’t exist at all.

  8. This worked for me, thanks!

  9. well done.
    Simple, straight-forward, briliant.

  10. It’s works ). thanks for solution )

  11. While the above is workable solution, Manual does include information about the absence of table mysql.proxies_priv

    http://dev.mysql.com/doc/refman/5.5/en/news-5-5-7.html

  12. Hi,
    I want to thank you, it was exactly the solutuion I looked for.
    Merry Christmas

  13. Thanks, and you too!

  14. You are a genius!

    This helped me so much!

  15. Hi Alex,

    You are also from Albany?

    –Derrick

  16. thanks a lot , you saved my time

  17. I had the same problem (on Mac) but not quite the same solution:

    # /usr/local/mysql/support-files/mysql.server start
    Starting MySQL
    …………………………………………… ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXXXX.pid).

    Run the following command
    # ps aux | grep mysql | grep -v grep

    It should output something like this:
    _mysql 204 0.0 1.2 2656240 51000 ?? S 10:04am 0:02.88 /usr/local/mysql/bin/mysqld –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –plugin-dir=/usr/local/mysql/lib/plugin –user=mysql –log-error=/usr/local/mysql/data/XXXXXXXX.err –pid-file=/usr/local/mysql/data/XXXXXXXX.pid –socket=/var/mysql/mysql.sock
    root 117 0.0 0.0 2435548 812 ?? S 10:04am 0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe –datadir=/usr/local/mysql/data –pid-file=/usr/local/mysql/data/XXXXXXXX.pid

    All you need to do now is to kill the process by using kill command

    # kill 204

    Check the process again if it’s been killed
    # ps aux | grep mysql | grep -v grep

    Now start your mysql sever
    sh-3.2# /usr/local/mysql/support-files/mysql.server start

    You should see
    Starting MySQL
    .. SUCCESS!

    :)

  18. I think #/usr/local/etc/rc.d/mysql-server start should be changed as
    #/usr/local/etc/rc.d/mysql-server onestart and ignore
    mysql_enable=”YES”
    mysql_args=”–skip-grant-tables –skip-networking”.It is safe and easy to handle.

  19. Thank you.
    This helped me so much!

  20. FYI another cause I’ve found for this error:
    Running MySQL enterprise 5.5.16
    From the slave DB server, I was unable to change the port and restart the mysqld daemon, and was getting the “server quit without updating PID file” error.

    To get around this, stop:
    mysql
    AND
    mysql-monitor-agent

    Make changes to my.cnf

    restart mysql
    restart mysql-monitor-agent

    Simple solution, I know, but hopefully saves someone some time out there.

  21. can also be caused by selinux.

  22. AlexZaharow says:

    if you use network access to mysql, may be check ip-address after reboot… ;)

  23. Derrick- You are the man!! I read many forums suggestions, with no luck, your suggestion fix it!!! Solution 2 worked for me..
    Thanks man and i owe you a beer :)

  24. 重启服务器就好了

Trackbacks/Pingbacks

  1. [MySQL 5.5] Starting MySQL … * The server quit without updating PID file | Jinny's Blog - [...] MySQL: Starting MySQL….. ERROR! The server quit without updating PID file Share this:Facebook This entry was posted …
  2. Bookmark 17 feb 14__PC | maulikblog - […] XtraBackup from Binaries — Percona XtraBackup Documentation</A> <DT><A HREF=”http://icesquare.com/wordpress/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file/…; ADD_DATE=”1342619828″ LAST_MODIFIED=”1342619828″ […]
  3. cmake安装mysql-5.5.33后无法启动 | 流年易逝 - […] http://icesquare.com/wordpress/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file/ […]

Leave a Reply