---
title: "Mysql Can't find file: './mysql/host.frm' (errno: 13) 的解决方法"
author: "181054867"
date: "2010-03-13T11:13:40Z"
tags: ["MySQL", "UP"]
categories: ["数据库"]
slug: "mysql-can-t-find-file-mysql-host-frm-errno-13"
draft: false
lastmod: "2010-03-13T11:13:40Z"
id: 614656
url: "https://181054867.iteye.com/blog/614656"
---

安装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即可