Mysql – Can’t create/write to file ‘/var/lib/thesql/aria_log_control’

mariadbMySQL

Something is wrong. I stopped MaridaDB, moved /var/lib/mysql to a different place, then replaced the old mysql with a softlink

cd /var/lib
ln -s /data/mysql .

Then I added

chown -R mysql:mysql mysql

and then I went to /data and did the same (Note: this relocation works fine in regular mysql). But in MariaDB

ERROR] mysqld: Can't create/write to file
'/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
[ERROR] mysqld: Got error 'Can't create file' when trying to use aria
control file '/var/lib/mysql/aria_log_control' [ERROR] Plugin 'Aria'
init function returned error. [ERROR] Plugin 'Aria' registration as a
STORAGE ENGINE failed.

So what can I do to fix this? I tried setting

chmod 777 /var/lib/mysql/aria_log_control

but to no avail.

Best Answer

In my case the problem was that while directory mysql and files within were owned by user mysql, the path has a directory that lacked x bit for the users that are not in the correct group. In other words, user could not move to the target directory because one of the directories in the path did not allow it.