. mysql host.frm_Mysql Can't find file: './mysql/host.frm' (errno: 13) 的解决方法

安装mysql后,使用mysqld_safe启动,错误如下:

[ROOT mysql]$ mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld

InnoDB: Log scan progressed past the checkpoint lsn 0 36808

100313 10:15:09  InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files...

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer...

InnoDB: Doing recovery: scanned up to log sequence number 0 43655

100313 10:15:09  InnoDB: Starting an apply batch of log records to the database...

InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

InnoDB: Apply batch completed

100313 10:15:09  InnoDB: Started; log sequence number 0 43655

100313 10:15:09 [ERROR] mysqld: Can't create/write to file '/var/run/mysqld' (Errcode: 21)

100313 10:15:09 [ERROR] Can't start server: can't create PID file: Is a directory

[ROOT mysql]$ mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid

InnoDB: Log scan progressed past the checkpoint lsn 0 36808

100313 10:16:23  InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files...

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer...

InnoDB: Doing recovery: scanned up to log sequence number 0 43655

100313 10:16:23  InnoDB: Starting an apply batch of log records to the database...

InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

InnoDB: Apply batch completed

100313 10:16:23  InnoDB: Started; log sequence number 0 43655

100313 10:16:23 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13)

100313 10:16:23 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13)

100313 10:16:23 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

呵呵,可能是我太笨了,找了很多论坛,都是说都权限问题,但没找到解决方法,最后在find -iname '*host.frm*'里知道host.frm是在mysql的系统表里,进行系统表查看权限:

[ROOT mysql]$ ll

total 780

-rwxrwx--- 1 root root   8820 2010-03-13 09:20 columns_priv.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 columns_priv.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 columns_priv.MYI

-rwxrwx--- 1 root root   9494 2010-03-13 09:20 db.frm

-rwxrwx--- 1 root root    876 2010-03-13 09:20 db.MYD

-rwxrwx--- 1 root root   4096 2010-03-13 09:20 db.MYI

-rwxrwx--- 1 root root   8665 2010-03-13 09:20 func.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 func.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 func.MYI

-rwxrwx--- 1 root root   8700 2010-03-13 09:20 help_category.frm

-rwxrwx--- 1 root root  20916 2010-03-13 09:20 help_category.MYD

-rwxrwx--- 1 root root   3072 2010-03-13 09:20 help_category.MYI

-rwxrwx--- 1 root root   8612 2010-03-13 09:20 help_keyword.frm

-rwxrwx--- 1 root root  78997 2010-03-13 09:20 help_keyword.MYD

-rwxrwx--- 1 root root  14336 2010-03-13 09:20 help_keyword.MYI

-rwxrwx--- 1 root root   8630 2010-03-13 09:20 help_relation.frm

-rwxrwx--- 1 root root   7425 2010-03-13 09:20 help_relation.MYD

-rwxrwx--- 1 root root  16384 2010-03-13 09:20 help_relation.MYI

-rwxrwx--- 1 root root   8770 2010-03-13 09:20 help_topic.frm

-rwxrwx--- 1 root root 347064 2010-03-13 09:20 help_topic.MYD

-rwxrwx--- 1 root root  17408 2010-03-13 09:20 help_topic.MYI

-rwxrwx--- 1 root root   9416 2010-03-13 09:20 host.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 host.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 host.MYI

-rwxrwx--- 1 root root   9691 2010-03-13 09:20 proc.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 proc.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 proc.MYI

-rwxrwx--- 1 root root   8875 2010-03-13 09:20 procs_priv.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 procs_priv.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 procs_priv.MYI

-rwxrwx--- 1 root root   8947 2010-03-13 09:20 tables_priv.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 tables_priv.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 tables_priv.MYI

-rwxrwx--- 1 root root   8636 2010-03-13 09:20 time_zone.frm

-rwxrwx--- 1 root root   8624 2010-03-13 09:20 time_zone_leap_second.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 time_zone_leap_second.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 time_zone_leap_second.MYI

-rwxrwx--- 1 root root      0 2010-03-13 09:20 time_zone.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 time_zone.MYI

-rwxrwx--- 1 root root   8606 2010-03-13 09:20 time_zone_name.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 time_zone_name.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 time_zone_name.MYI

-rwxrwx--- 1 root root   8686 2010-03-13 09:20 time_zone_transition.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 time_zone_transition.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 time_zone_transition.MYI

-rwxrwx--- 1 root root   8748 2010-03-13 09:20 time_zone_transition_type.frm

-rwxrwx--- 1 root root      0 2010-03-13 09:20 time_zone_transition_type.MYD

-rwxrwx--- 1 root root   1024 2010-03-13 09:20 time_zone_transition_type.MYI

-rwxrwx--- 1 root root  10330 2010-03-13 09:20 user.frm

-rwxrwx--- 1 root root    224 2010-03-13 09:20 user.MYD

-rwxrwx--- 1 root root   2048 2010-03-13 09:20 user.MYI

晕,原来真是权限问题:

[ROOT mysql]$ chown mysql *

[ROOT mysql]$ chgrp mysql *

[ROOT mysql]$ chmod ug+rwx *

再重启mysql即可

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2010-03-13 11:13

浏览 42268

分类:数据库

评论

3 楼

763863446

2017-05-12

非常感谢博主,整好解决了问题!!!

966903dea4bcb507358d5dcce8b912e5.gif 

38687d1a1ad71d37c86f287056834d1a.gif

2 楼

java_doom

2013-09-09

不错 太赞了 我也遇到同样的问题 看到你这篇才解决

1 楼

thebye85

2010-11-03

原来如此,刚才遇到这个问题。谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值