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

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   strong   io   檔案   

文章來源:http://icesquare.com/wordpress/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file/

今天啟動MySQL 遇見了這個問題,網上搜尋,結果各種改檔案,刪除檔案純屬坑爹;在上邊的網站上發現了問題的解決方案~老外總結的真不錯!拿過來自己學習一下

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.

1,啟動MySQL
/usr/local/etc/rc.d/mysql.server start 
2,發現了下述錯誤
  
  Starting MySQL..... ERROR! The server quit without updating PID file.

3,錯誤資訊很明確的定位你出現的問題
 Starting MySQL..... ERROR! The server quit without updating PID file (/var/db/mysql/www.icesquare.com.pid).
三種解決方案如下:
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.0M101112 10:49:16  InnoDB: Completed initialization of buffer pool101112 10:49:16  InnoDB: highest supported file format is Barracuda.101112 10:49:17  InnoDB: 1.1.3 started; log sequence number 1589404101112 10:49:17 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.proxies_priv‘ doesn‘t exist101112 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:
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: mysqlLooking for ‘mysqlcheck‘ as: mysqlcheckRunning ‘mysqlcheck‘ with connection arguments: ‘--port=3306‘ ‘--socket=/tmp/mysql.sock‘Running ‘mysqlcheck‘ with connection arguments: ‘--port=3306‘ ‘--socket=/tmp/mysql.sock‘mysql.columns_priv                                 OKmysql.db                                           OKmysql.event                                        OKmysql.func                                         OKmysql.general_log                                  OKmysql.help_category                                OKmysql.help_keyword                                 OKmysql.help_relation                                OKmysql.help_topic                                   OKmysql.host                                         OKmysql.ndb_binlog_index                             OKmysql.plugin                                       OKmysql.proc                                         OKmysql.procs_priv                                   OKmysql.servers                                      OKmysql.slow_log                                     OKmysql.tables_priv                                  OKmysql.time_zone                                    OKmysql.time_zone_leap_second                        OKmysql.time_zone_name                               OKmysql.time_zone_transition                         OKmysql.time_zone_transition_type                    OKmysql.user                                         OKRunning ‘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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.