Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table is 'read only'

When I want to execute an update query on my table I got an error saying:

1036 - Table data is read only.

How can I fix that?

Table attributes in /var/db/mysql are set to 777.

'Repair Table' function doesnt seems to help.

Is there anything I can do with that?

like image 495
Cyclone Avatar asked Mar 05 '12 23:03

Cyclone


People also ask

Why is my table read only?

You should at least have the necessary privileges on your specific table. If that's the case, try to repair the table (it may have crashed). If you're still getting “read only” messages, check the file permissions in /var/lib/mysql/dbname/tbl_name (assuming your database is in /var/lib/mysql).

How do I change a SQL table from read only?

Using SQL SERVER Management Studio: Right click on Database, select Properties. And in the Database Properties window, select Options page. In Options page, under State change Database Read Only value to False.

How can you tell if a table is read only?

To identify if a table is read-only, a new column called READ_ONLY has been added to DBA_TABLES, USER_TABLES, and ALL_TABLES. This column is set to YES if the table is read-only and NO when the table is not read-only.


2 Answers

In my case, mysql config file had innodb_force_recovery = 1. Commenting that out solved the issue. Hope it helps someone.

like image 76
Rahi Avatar answered Sep 24 '22 04:09

Rahi


who owns /var/db/mysql and what group are they in, should be mysql:mysql. you'll also need to restart mysql for changes to take affect

also check that the currently logged in user had GRANT access to update

like image 30
ncremins Avatar answered Sep 21 '22 04:09

ncremins