X
    Categories: My_Note

升級 MySQL 完成後, 建議手動執行的命令(Ubuntu、Debian Linux)

上星期機器當機, 很奇怪的是, 隔壁的機器居然也在幾分鐘後一起當了.

  • 註1: 兩台做的事情完全不同, 而且機器都不操.
  • 註2: 兩台都是 Ubuntu Linux.

問題

重新開機後, 查看當機前發生的事情, 都是出現下述訊息:

  • $ sudo less /var/log/syslog
    Oct  8 20:15:13 example kernel: [5695418.376686] type=1505 audit(1286540113.390:48176):  operation="profile_replace" pid=26753 name="/usr/sbin/mysqld"
    Oct  8 20:15:13 example /etc/mysql/debian-start[26767]: Upgrading MySQL tables if necessary.
    Oct  8 20:15:13 example /etc/mysql/debian-start[26770]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
    Oct  8 20:15:13 example /etc/mysql/debian-start[26770]: Looking for 'mysql' as: /usr/bin/mysql
    Oct  8 20:15:13 example /etc/mysql/debian-start[26770]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
    Oct  8 20:15:13 example /etc/mysql/debian-start[26770]: This installation of MySQL is already upgraded to 5.1.41 , use --force if you still need to run mysql_upgrade
    Oct  8 20:15:13 example /etc/mysql/debian-start[26777]: Checking for insecure root accounts.
    Oct  8 20:15:13 example /etc/mysql/debian-start[26781]: Triggering myisam-recover for all MyISAM tables
    Oct  8 20:15:39 example init: mysql main process (26757) killed by KILL signal

解法

看來像是 MyISAM 的 Table 出問題, 但是, 檢查起來都沒任何異常, 先假設是升級 MySQL 造成的問題, 所以手動執行 mysql_upgrade 來完成升級動作.

註: 下述指令於 MySQL upgrade 後, 都可以手動執行. (InnoDB 執行 mysql_upgrade 沒有作用, MyISAM 會做檢查、修復的動作)

  1. $ sudo mysql_upgrade -u root -p # 若出現下述訊息, 則加上 --force

    This installation of MySQL is already upgraded to 5.1.49, use --force if you still need to run mysql_upgrade

  2. $ sudo mysql_upgrade --force -u root -p

    Looking for 'mysql' as: mysql
    Looking for 'mysqlcheck' as: mysqlcheck
    Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock'
    Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock'
    mysql.columns_priv                                 OK
    mysql.db                                           OK
    mysql.event                                        OK
    mysql.func                                         OK
    Running 'mysql_fix_privilege_tables'...
    OK

  3. $ sudo /etc/init.d/mysql restart # 重新啟動 MySQL

暫時做個紀錄, 希望別再發生問題.

Tsung: 對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
Related Post