Linux – Symbolic link to thesql database

file-permissionslinuxMySQLpermissions

I had to make a symbolic link on one of databases to another location on MySQL (Debian 6.0). So /var/lib/mysql/dbname points to /home/user/dbname, but MySQL gives

MySQL error: 1017 (Can't find file: './dbname/tbl201206.frm' (errno: 13))

I have read some manuals about making symbolic links on data dirs or table files, but can mysqld read also this kind of links?

Best Answer

The error code (errno: 13) means permission denied. Check that the mysql user has permission to read and write /home/user/dbname and all the files below it.

You can do this with sudo su mysql and then some command that accesses the file such as file /home/user/dbname/tbl201206.frm.

To fix it, you probably want to do chown -R mysql:mysql /home/user/dbname. You also may need chmod +x /home/user.