MySQL Error 1036: Read Only Table

When I try to insert a record into a table using phpmyadmin, it gives me

#1036 - Table 'sch_portfolio' is read only 

In some articles, I have seen that this can happen if the owner of this table is something other than mysql. so I set the owner as mysql and restart the server. However, I get the same error. Any help could be helpful. thanks in advance

 drwxrwxrwx 2 mysql mysql 4096 Jul 13 15:27 schooltap 
+8
mysql phpmyadmin
source share
6 answers

This requires super-user privileges, most often sudo is used for this.

in order to change the owner of the files.

 sudo chown -R mysql:mysql /var/lib/mysql 

Restart mysql for changes

 sudo service mysql restart 

to which sch_portfolio belongs and what group they are in should be mysql: mysql. you will also need to restart mysql so that the changes affect

also check that the current user with access to the account had GRANT access to upgrade

The MySQL server works as user mysql , and not as the user with whom I logged in. To access files with user rights, they must belong to the user 'mysql' , since this is what works on the server. Make sure the folder and files used by mysql belong to the mysql user. These files are located in the /var/lib/mysql directory. The directory itself must also belong to 'mysql' .

+9
source share

Make sure you have not set innodb_force_recovery> 0 in my.cnf

+25
source share

For me, this is because of the storage mechanism. If you select storage engine as MRG_MYISAM , then this will make your table only readable , you will not be able to insert data. So select myisam as storage engine ..

+3
source share

I suspect that in my case it was caused by the Bytefence hidden antivirus (probably it was connected with something else). The problem disappeared after removing this antivirus.

0
source share

You can change the storage mechanism so that you do not have to change the settings. If you install InnoDB, your problem should be resolved. (You can change it on the operations tab in phpmyadmin)

0
source share

I had a similar problem and the solution for me was to change the owner / group of table files in MySQL. You can do two options

one

first you must go to your server and get privileges

 sudo su 

and then I went to the hidden mysql folder, doing:

 cd /var/lib/mysql/ 

and then I ran this command:

 chown -R mysql:mysql * 

and it will solve your problem

Then, to see if this works, you must restart MySQL

 service mysql restart 

2

or you can just go to phpmyadmin, then select all tables in your database and then you need to select the repair option enter image description here (sorry, I got phpmyadmin in Italian), you can do this also in bash,

and it will work! if the option does not work try reinstalling mysql

0
source share

All Articles