Column count of mysql.proc is wrong. Expected 20, found 16.解決方法

1558 - Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50018, now running 50146. Please use mysql_upgrade to fix this error.

今天58lianmeng服務器上出現了這個不起眼的錯誤。

其實這個錯誤如果用phpmyadmin的話發現不了、
錯誤來源,是由於你曾經升級過數據庫
升級完後未使用mysql_upgrade升級數據結構造成的。
用Navicat For MySQL會有此錯誤提示。
記錄一下解決方法

mysql.proc
這個是5.1裏面的系統表來的,用來記錄存儲過程或函數的信息.

你的數據庫肯定作過升級或用不同的版本進行備份遷移恢復.

解決辦法:
使用命令:mysql_upgrade 就可以解決

mysql_upgrade -u root -p123456 --datadir=D:\Database --basedir=D:\Mysql
MySQL utility for upgrading databases to new MySQL versions.


 問題

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

  • $ 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

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章