Can't find file: './ci/users.frm' (errno: 13)

Viewed 43860

I installed LAMP on Ubuntu 11.04 and copy project from Windows. PHP directory (/ci/) to var/www/ and MySQL project directory (/ci/) to var/lib/mysql/

Full text of error that i get:

A Database Error Occurred

    Error Number: 1017
    Can't find file: './ci/users.frm' (errno: 13)
    SELECT COUNT(*) AS `numrows` FROM (`users`) WHERE `email` = 'admin@localsite.com'

I googled that its permission problem, but don't know what do next.

Log from /var/log/mysql/error.log:

    110622 19:27:21 [ERROR] /usr/sbin/mysqld: Can't find file: './ci/users.frm' (errno: 13)
7 Answers

@Brent Baisley It does work in XAMPP for Linux, but the location is different.

I did upgrade the Kernel today to fix the new Linux “Dirty Cow” Vulnerability (CVE-2016-5195). After the reboot I got the 'frm' permission error too.

So, if you get the following error:

Can't find file: 'yourtablename.frm' (errno: 13 - Permission denied) SQL query :...

You can do:

chown mysql:mysql /opt/lampp/var/mysql/yourDBname/*.frm

This will resolve your issue.

If you'd like to check, if your permission to any of the files has been modified before you execute the permission change, do:

ls -l /opt/lampp/var/mysql/yourDBname/*.frm

Hope that helps someone.

If you have failed RENAME TABLE statement, it could leave MySQL metadata in bad state. The solution is to recreate schema or to recreate table.

Related