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>
更新2:
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
更新3:
$ 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
答案1
这很可能会在运行 MySQL 升级时得到解决,因为这似乎是模式更改的结果。
mysql_upgrade -u 根 -p
如果您的管理帐户的用户名不是 root,请按照上面的示例进行更改。
答案2
也许下面的方法可以解决这个问题?
mysql> REPAIR TABLE mysql.proc;
答案3
我也遇到了这个问题,显示错误的原因是因为我调用了错误的函数......
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