I used MAMP on my local machine to make a little site with a mysql database. I moved all the site files over the to server. Great.

The name of my database is roster and it has one table called users. I copied the 'roster' folder which contains the following files:


I put the 'roster' folder in the mysql directory. I run the following:

$db = mysql_connect("localhost","username","password") or die ('Fail message1');
mysql_select_db("roster") or die("Fail message2");

No error. Awesome. But when I run the following:

$query = "SELECT last_name, first_name, u_name, skype_id, primary_location FROM users";

$result = mysql_query($query)or die('query error'.mysql_error());

Then I receive the following error:

query errorCan't find file: './roster/users.frm' (errno: 13)

Furthermore, when I login to the server and login to mysql. I see the database and table:

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| phones_db          |
| roster             |
4 rows in set (0.00 sec)

mysql> use roster;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;
| Tables_in_roster |
| users            |
1 row in set (0.00 sec)

mysql> select * from users;
ERROR 1017 (HY000): Can't find file: './roster/users.frm' (errno: 13)

I checked the 'roster' folder and it contains the four files mentioned at the beginning of this post. The file is where it supposed to be, right? Did I move the database wrong? What gives? Any ideas?

up vote 3 down vote accepted


You have a file permission issue.

The INFORMATION_SCHEMA database will not notice when doing just show tables; because it will scan for the .frm's existence. It's when the storage engine attempts to access the physical files (.MYD and .MYI') that mysqld will complain. All physical files of any table must havemysqlas its owner. When the error saysCan't find file: './roster/users.frm' (errno: 13)`, it really means it cannot find the table's physical files with proper file permissions.


Change the owner of the roster folder and its contents to mysql.


  • 1
    +1 Also disable SELinux. SELinux frequently reports errors in file locations, permissions, etc. as "file not found." – Bill Karwin Oct 1 '13 at 17:47

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.