MySQL 1036: Table is read-only.

  1. Check the file system permissions: Ensure the MySQL server has write permissions on the table files. You can use `ls -l /path/to/mysql/data/database_name` to check permissions and `chmod` to modify them if necessary.



  1. Verify the read-only mode of MySQL:


- Run `SHOW GLOBAL VARIABLES LIKE 'readonly';` to check if the database is in read-only mode. If it returns `ON`, turn it off using `SET GLOBAL readonly = OFF;`.

  1. Check the storage engine status:


- Run `SHOW TABLE STATUS LIKE 'yourtablename';` and check the `Engine` and `Comment` columns to ensure the table is using an engine like InnoDB and there are no special comments indicating issues.

  1. Examine disk space:


- Ensure there is enough disk space on the server. Use `df -h` to check disk space.

  1. Check for file system read-only status:


- Run `mount` to see if the file system is mounted as read-only. If it is, you may need to remount it with write permissions using `mount -o remount,rw /partition`.

  1. Review MySQL error logs:


- Check the MySQL error log for any messages related to the read-only issue. The location can vary, but you can find it using `SHOW VARIABLES LIKE 'log_error';`.

  1. Repair the table if it's marked as crashed or corrupt:


- For MyISAM, use `REPAIR TABLE yourtablename;`.
- For InnoDB, if the table is marked as crashed, you might need to dump and reload the database or restore from a backup if the corruption is severe.

Master

MySQL

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MySQL

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid