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

暂时做个纪录, 希望别再发生问题. 


你可能感兴趣的:(数据结构,数据库,mysql,phpMyAdmin,database,Signal)