mysql:无法从mysql.proc加载。该表可能已损坏


22

MySQL已启动:

/usr/bin/mysqld_safe  --datadir=/srv/mysql/myDB --log-error=/srv/mysql/logs/mysqld-myDB.log --pid-file=/srv/mysql/pids/mysqld-myDB.pid --user=mysql  --socket=/srv/mysql/sockets/mysql-myDB.sock --port=3700

但是当我尝试做某事时:

ERROR 1548 (HY000) at line 1: Cannot load from mysql.proc. The table is probably corrupted

如何解决?

$ mysql -V
mysql  Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (x86_64) using readline 6.2

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 11.10
Release:        11.10
Codename:       oneiric

$ sudo mysql_upgrade -uroot -p<password> --force
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
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.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
Running 'mysql_fix_privilege_tables'...
OK

$ mysqlcheck --port=3700 --socket=/srv/mysql/sockets/mysql-my-env.sock -A -udata_owner -pdata_owner
<all tables> OK 

UPD1:例如,我正在尝试删除过程:

mysql> DROP PROCEDURE IF EXISTS mysql.myproc;
ERROR 1548 (HY000): Cannot load from mysql.proc. The table is probably corrupted
mysql>

UPD2:

mysql> REPAIR TABLE mysql.proc;
+------------+--------+----------+-----------------------------------------------------------------------------------------+
| Table      | Op     | Msg_type | Msg_text                                                                                |
+------------+--------+----------+-----------------------------------------------------------------------------------------+
| mysql.proc | repair | error    | 1 when fixing table                                                                     |
| mysql.proc | repair | Error    | Can't change permissions of the file '/srv/mysql/myDB/mysql/proc.MYD' (Errcode: 1) |
| mysql.proc | repair | status   | Operation failed                                                                        |
+------------+--------+----------+-----------------------------------------------------------------------------------------+
3 rows in set (0.04 sec)

这很奇怪,因为:

$ ls -l /srv/mysql/myDB/mysql/proc.MYD
-rwxrwxrwx 1 mysql root 3983252 2012-02-03 22:51 /srv/mysql/myDB/mysql/proc.MYD

UPD3:

$ ls -la /srv/mysql/myDB/mysql
total 8930
drwxrwxrwx  2 mysql root    2480 2012-02-21 13:13 .
drwxrwxrwx 13 mysql root     504 2012-02-21 19:01 ..
-rwxrwxrwx  1 mysql root    8820 2012-02-20 15:50 columns_priv.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 columns_priv.MYD
-rwxrwxrwx  1 mysql root    4096 2012-02-20 15:50 columns_priv.MYI
-rwxrwxrwx  1 mysql root    9582 2012-02-20 15:50 db.frm
-rwxrwxrwx  1 mysql root    8360 2011-12-08 02:14 db.MYD
-rwxrwxrwx  1 mysql root    5120 2012-02-20 15:50 db.MYI
-rwxrwxrwx  1 mysql root      54 2011-11-12 15:42 db.opt
-rwxrwxrwx  1 mysql root   10223 2012-02-20 15:50 event.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 event.MYD
-rwxrwxrwx  1 mysql root    2048 2012-02-20 15:50 event.MYI
-rwxrwxrwx  1 mysql root    8665 2012-02-20 15:50 func.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 func.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 func.MYI
-rwxrwxrwx  1 mysql root    8700 2012-02-20 15:50 help_category.frm
-rwxrwxrwx  1 mysql root   21497 2011-11-12 15:42 help_category.MYD
-rwxrwxrwx  1 mysql root    3072 2012-02-20 15:50 help_category.MYI
-rwxrwxrwx  1 mysql root    8612 2012-02-20 15:50 help_keyword.frm
-rwxrwxrwx  1 mysql root   88650 2011-11-12 15:42 help_keyword.MYD
-rwxrwxrwx  1 mysql root   16384 2012-02-20 15:50 help_keyword.MYI
-rwxrwxrwx  1 mysql root    8630 2012-02-20 15:50 help_relation.frm
-rwxrwxrwx  1 mysql root    8874 2011-11-12 15:42 help_relation.MYD
-rwxrwxrwx  1 mysql root   16384 2012-02-20 15:50 help_relation.MYI
-rwxrwxrwx  1 mysql root    8770 2012-02-20 15:50 help_topic.frm
-rwxrwxrwx  1 mysql root  414320 2011-11-12 15:42 help_topic.MYD
-rwxrwxrwx  1 mysql root   20480 2012-02-20 15:50 help_topic.MYI
-rwxrwxrwx  1 mysql root    9510 2012-02-20 15:50 host.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 host.MYD
-rwxrwxrwx  1 mysql root    2048 2012-02-20 15:50 host.MYI
-rwxrwxrwx  1 mysql root    8554 2011-11-12 15:42 innodb_monitor.frm
-rwxrwxrwx  1 mysql root   98304 2011-11-12 15:55 innodb_monitor.ibd
-rwxrwxrwx  1 mysql root    8592 2012-02-20 15:50 inventory.frm
-rwxrwxrwx  1 mysql root      76 2011-11-12 15:42 inventory.MYD
-rwxrwxrwx  1 mysql root    2048 2012-02-20 15:50 inventory.MYI
-rwxrwxrwx  1 mysql root    8778 2012-02-20 15:50 ndb_binlog_index.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 ndb_binlog_index.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 ndb_binlog_index.MYI
-rwxrwxrwx  1 mysql root    8586 2012-02-20 15:50 plugin.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 plugin.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 plugin.MYI
-rwxrwxrwx  1 mysql root    9996 2012-02-20 15:50 proc.frm
-rwxrwxrwx  1 mysql root 3983252 2012-02-03 22:51 proc.MYD
-rwxrwxrwx  1 mysql root   36864 2012-02-21 13:23 proc.MYI
-rwxrwxrwx  1 mysql root    8875 2012-02-20 15:50 procs_priv.frm
-rwxrwxrwx  1 mysql root    1700 2011-11-12 15:42 procs_priv.MYD
-rwxrwxrwx  1 mysql root    8192 2012-02-20 15:50 procs_priv.MYI
-rwxrwxrwx  1 mysql root 3977704 2012-02-21 13:23 proc.TMD
-rwxrwxrwx  1 mysql root    8800 2012-02-20 15:50 proxies_priv.frm
-rwxrwxrwx  1 mysql root     693 2011-11-12 15:42 proxies_priv.MYD
-rwxrwxrwx  1 mysql root    5120 2012-02-20 15:50 proxies_priv.MYI
-rwxrwxrwx  1 mysql root    8838 2012-02-20 15:50 servers.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 servers.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 servers.MYI
-rwxrwxrwx  1 mysql root    8955 2012-02-20 15:50 tables_priv.frm
-rwxrwxrwx  1 mysql root    5957 2011-11-12 15:42 tables_priv.MYD
-rwxrwxrwx  1 mysql root    8192 2012-02-20 15:50 tables_priv.MYI
-rwxrwxrwx  1 mysql root    8636 2012-02-20 15:50 time_zone.frm
-rwxrwxrwx  1 mysql root    8624 2012-02-20 15:50 time_zone_leap_second.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 time_zone_leap_second.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 time_zone_leap_second.MYI
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 time_zone.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 time_zone.MYI
-rwxrwxrwx  1 mysql root    8606 2012-02-20 15:50 time_zone_name.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 time_zone_name.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 time_zone_name.MYI
-rwxrwxrwx  1 mysql root    8686 2012-02-20 15:50 time_zone_transition.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 time_zone_transition.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 time_zone_transition.MYI
-rwxrwxrwx  1 mysql root    8748 2012-02-20 15:50 time_zone_transition_type.frm
-rwxrwxrwx  1 mysql root       0 2011-11-12 15:42 time_zone_transition_type.MYD
-rwxrwxrwx  1 mysql root    1024 2012-02-20 15:50 time_zone_transition_type.MYI
-rwxrwxrwx  1 mysql root   10630 2012-02-20 15:50 user.frm
-rwxrwxrwx  1 mysql root    5456 2011-11-12 21:01 user.MYD
-rwxrwxrwx  1 mysql root    4096 2012-02-20 15:50 user.MYI

遇到该错误时,您要尝试执行的“操作”是什么?
nickgrim'2

例如,@ nickgrim我正在尝试删除程序。参见上面的例子。
亚历克斯(Alex)

停止mysql服务并运行lsof。东西打开了吗?
longneck 2012年

当您尝试执行某些操作时,是否还可以粘贴在mysql日志中看到的日志输出。
GeekRide 2013年

Answers:


52

运行MySQL升级时,很可能会解决此问题,因为这似乎是架构更改的结果。

mysql_upgrade -u root -p

如果您的管理帐户用户名不是root用户,请在上面的示例中进行更改。


3
我需要mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`与plesk 一起使用,以防万一有人对plesk有此问题
Ties

@Ties谢谢你,你的解决方案对我有用!!!
Dipesh KC 2015年

1
我遇到了从CentOS到Debian的问题。同样的MySQL版本。只需快速mysql_upgrade即可解决此问题。
frustratedtech

与@frustratedtech相同。遇到了从CentOS到Ubuntu的迁移并解决了这一问题。我必须--force在命令中添加参数,因为我是从一个MySQL版本“升级”到相同版本的MySQL。
Nate

对于拥有MySQL 5.7的用户。“密码”列已重命名为“ authentication_string”。
达尔曼·阿曼巴耶夫'17

1

我也有这个问题,原因是显示该错误是因为我调用了错误的函数...。

mysql> select count(*) from authmap where strlen(authname) > 255;

ERROR 1548 (HY000): Cannot load from mysql.proc. The table is probably corrupted

mysql> select count(*) from authmap where char_length(authname) > 255;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

# mysql --version
mysql  Ver 14.14 Distrib 5.5.41, for Linux (x86_64) using readline 5.1

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.