mysql用户表损坏

今天打开phpmyadmin要删除某个表的时候发现删除按钮没了,只显示了表名没有选择按钮。打开用户列表报错。百度了一下,好像说数据库没设置密码?我当时表情如图

然后打开xampp要改密码的时候发现报错,发现是用户表顺坏....
先查看表是否损坏

check table mysql.user;
+------------+-------+----------+-----------------------------------------------------------------+
| Table      | Op    | Msg_type | Msg_text                                                        |
+------------+-------+----------+-----------------------------------------------------------------+
| mysql.user | check | warning  | Size of indexfile is: 56908      Should be: 4096                |
| mysql.user | check | warning  | Size of datafile is: 36876       Should be: 376                 |
| mysql.user | check | error    | Can't read indexpage from filepos: 2048                         |
| mysql.user | check | Error    | Index for table '.\mysql\user.MYI' is corrupt; try to repair it |
| mysql.user | check | error    | Corrupt                                                         |
+------------+-------+----------+-----------------------------------------------------------------+

看到损坏了,运行修复命令

repair table mysql.user;
+------------+--------+----------+--------------------------------------------+
| Table      | Op     | Msg_type | Msg_text                                   |
+------------+--------+----------+--------------------------------------------+
| mysql.user | repair | info     | Wrong bytesec:  50- 48- 50 at 376; Skipped |
| mysql.user | repair | status   | OK                                         |
+------------+--------+----------+--------------------------------------------+

修复完成就可以正常使用了。再运行一遍就可以看到表没问题了

check table mysql.user;
+------------+-------+----------+----------+
| Table      | Op    | Msg_type | Msg_text |
+------------+-------+----------+----------+
| mysql.user | check | status   | OK       |
+------------+-------+----------+----------+

修复表

发表评论

1条评论

    心灵博客

    2020-08-14 Mac / Chrome 回复

    如果真正损坏就麻烦了


设置
配色方案

布局

现在购买