解决警告:数据库错误Column count of mysql.proc is wrong.

事实上,如果你使用phpMyAdmin,你找不到错误问题出在哪里?

  • 问题就因为你已升级MariaDB或MySQL数据库版本。
  • 升级MariaDB或MySQL数据库版本后,数据结构未使用mysql_upgrade命令完成升级更新。
  • 之后,操作MySQL数据库过程中,可能将显示错误消息.

MySQL数据库LOGO

WordPress插件在自动备份过程期间,发生以下错误 ▼

警告: 数据库错误 Column count of mysql.proc is wrong. Expected 21, found 20. Created with MariaDB 50560, now running 100406. Please use mysql_upgrade to fix this error 查询 SHOW FUNCTION STATUS

  • mysql.proc 这是5.1中的系统表,它记录有关存储过程或函数的信息。

如何解决警告:数据库错误 Column count of mysql.proc is wrong?

以下是陈沩亮记录的解决方案。

第 1 步:保险做法是先dump或冷备份:

mysqldump -uroot -p123456 --quick --master-data=1 --all-databases --flush-logs --lock-tables >
  • 请将以上的“123456”,改成你的MySQL的root密码。

第 2 步:使用以下mysql_upgrade 命令来解决

mysql_upgrade -u root --datadir=/var/lib/mysql/ --basedir=/ --password=123456

以下是SSH示范操作过程 ▼

[root@db lib]# mysql_upgrade -u root -p123456 -hdb --datadir=/var/lib/mysql/ --basedir=/
mysql_upgrade: the '--datadir' option is always ignored
mysql_upgrade: the '--basedir' option is always ignored
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--host=db'
Running 'mysqlcheck' with connection arguments: '--host=db'
mysql.columns_priv                                OK
mysql.db                                          OK
mysql.event                                       OK
mysql.func                                        OK
mysql.general_log
Error   : You can't use locks with log tables.
status  : 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
Error   : You can't use locks with log tables.
status  : OK
mysql.student                                     OK
mysql.t1                                          OK
mysql.t2                                          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
................................................
test.newuser                                      OK
test.usertag                                      OK
Running 'mysql_fix_privilege_tables'...
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
OK
[root@db lib]#

以下还有更多MySQL数据库问题的解决方法 ▼