MySQL table file ownership getting reset
I can't find any answers to this question which solve the problem.
When a table optimize is executed, on any table in any database, it causes the table to crash with the following output:
thetable optimize Error Table './db/thetable' is marked as crashed and last (automatic?) repair failed
db.thetable optimize Error Table 'thetable' is marked as crashed and last (automatic?) repair failed
db.thetable optimize error Corrupt
At which point I execute "repair table thetable;" and get this result:
db.thetable repair error 1 when fixing table
db.thetable repair Error Can't change ownership of the file '/var/lib/mysql/db/thetable.MYD' (Errcode: 1)
db.thetable repair status Operation failed
When I check the table files, there is now a TMD file with incorrect permissions:
-rwx------ 1 mysql mysql 10116 Aug 5 09:55 thetable.MYD
-rwx------ 1 mysql mysql 27648 Aug 5 09:59 thetable.MYI
-rwx------ 1 mysql 1000 10048 Aug 5 09:59 thetable.TMD
-rwx------ 1 mysql mysql 8808 Aug 5 09:10 thetable.frm
I have run: chmod -R 700 /var/lib/mysql/
and: chown -R mysql:mysql /var/lib/mysql/
But it seems the group ownership still gets reset to 1000 when running optimize.
Thanks,
|