You may receive the following error while repairing or optimizing the MySQL tables:
#1036 – Table ‘xyz’ is read only
When the MySQL tables are in “read only” status, you can update or insert any data in them. In most cases this happens due to incorrect ownership for mysql data directory or data files. The ownership of the mysql director and data files must be mysql:mysql. To correct the ownership, you can run the following command via SSH:
chown -R mysql:mysql /var/lib/mysql
If MySQL data are not stored in /var/lib/mysql, you will need to update this path as per your installation. After changing the ownership, you will need to restart MySQL service:
service mysql restart
This should fix the “read only” status.