MySQL Error Code: 1017 permission denied

Radi asked:

I have downloaded the German version of the Northwind sample database. I moved the folder to /var/lib/mysql and set the rights to drwxr-x---.

Here is an output of /var/lib/mysql

drwxr-x--- 2 mysql mysql     4096 24. Jan 2016  nordwind

However I am able to use the DB but as soon as I try to access to any table I get the following error:

For example:

SELECT * FROM artikel;

Error Code: 1017. Can't find file: './nordwind/artikel.frm' (errno: 13 - Permission denied) 0.0021 sec

Here is an output from /var/lib/nordwind

-rwxrwxrwx. 1 mysql mysql   9002 14. Aug 2007  artikel.frm
-rwxrwxrwx. 1 mysql mysql   5204 14. Aug 2007  artikel.MYD
-rwxrwxrwx. 1 mysql mysql   1024 14. Aug 2007  artikel.MYI

EDIT: I run the mysql-server on Fedora Server 23

Thanks in advance for any help

My answer:


You have SELinux enabled, and you moved the files instead of copying them. Therefore they have their original context (probably user_home_t or something similar) rather than the necessary context for MySQL to use them.

To solve the problem, put the files in the correct place in the directory structure (probably /var/lib/mysql/nordwind and run restorecon on the files.

restorecon -r -v /var/lib/mysql/nordwind

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.