MySQL 错误 1036:表是只读的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17629407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:08:22  来源:igfitidea点击:

MySQL error 1036: table is read only

mysqlphpmyadmin

提问by Dilantha

When im trying to insert a record to the table using phpmyadmin it gives me

当我尝试使用 phpmyadmin 在表中插入一条记录时,它给了我

#1036 - Table 'sch_portfolio' is read only 

I saw in some articles they said that this could happen if the owner of this table is somthing other than mysql. so i set the owner as mysql and restart the server. Still im getting the same error. any help would be really appreciated. Thanks in advance

我在一些文章中看到他们说,如果此表的所有者不是 mysql,则可能会发生这种情况。所以我将所有者设置为 mysql 并重新启动服务器。我仍然遇到同样的错误。任何帮助将非常感激。提前致谢

drwxrwxrwx 2 mysql mysql     4096 Jul 13 15:27 schooltap

回答by dklovedoctor

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

确保您没有在 my.cnf 中设置 innodb_force_recovery > 0

回答by Ghostman

One needs super user privs to do this, most commonly sudo is used to acheve this.

一个需要超级用户权限才能做到这一点,最常见的 sudo 用于实现这一点。

in order too Change the owner of the files.

为了太更改文件的所有者。

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

Reboot Mysql for the changes

重新启动 Mysql 以进行更改

sudo service mysql restart

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

谁拥有sch_portfolio以及他们在哪个组中,应该是 mysql:mysql。您还需要重新启动 mysql 以使更改生效

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

还要检查当前登录的用户是否具有更新的 GRANT 访问权限

The MySQL server is running as user mysqland not as the user I logged into it with. In order for it to access files that have user only rights they must be owned by user ‘mysql'since that is what the server is running as. Make sure the folder and files used by mysql belong to the user ‘mysql'. These files are located in the /var/lib/mysqldirectory. The directory itself should also belong to ‘mysql'.

MySQL 服务器user mysql以我登录的用户身份运行,而不是以我登录它的用户身份运行。为了让它访问只有用户权限的文件,它们必须归用户所有,‘mysql'因为这是服务器运行的方式。确保mysql使用的文件夹和文件属于用户'mysql'。这些文件位于/var/lib/mysql目录中。目录本身也应该属于‘mysql'.

回答by klaus

According to me, this is because of storage engine . If you select storage engine as MRG_MYISAMthen that will make your table only readable, you can't insert data. So, select myisam as storage engine..

据我所知,这是因为存储引擎。如果你select storage engine as MRG_MYISAM那只会让你的表readable,你不能插入数据。所以,select myisam as storage engine..

回答by R4y

i had a similar problem and the solution for me was to change the owner/group of the table files to mysql. you can do two options

我有一个类似的问题,我的解决方案是将表文件的所有者/组更改为 mysql。你可以做两个选择

1

1

for first you have to go in your server and get privilegies

首先你必须进入你的服务器并获得特权

sudo su

and then i went to the hidden folder mysql doing:

然后我去了隐藏文件夹 mysql 做:

cd /var/lib/mysql/

and then i ran this command:

然后我运行了这个命令:

chown -R mysql:mysql *

and this will solve your problem

这将解决您的问题

then to see if it works you have to reboot the mysql

然后看看它是否有效,你必须重新启动mysql

service mysql restart

2

2

or you can simply go to phpmyadmin then to your database select all the tables and then you have to select option repairenter image description here(sorry i got phpmyadmin in italian) you can do this also in bash,

或者您可以简单地转到 phpmyadmin 然后到您的数据库选择所有表 ,然后您必须选择选项修复在此处输入图片说明(对不起,我有意大利语的 phpmyadmin)您也可以在 bash 中执行此操作,

and this will work! if no option work try to reinstall mysql

这会奏效!如果没有选项工作尝试重新安装mysql

回答by Cinava

I suspect that in my case, this was caused by a hidden anti malware antivirus Bytefence (probably, it was bundled with something else). The problem was gone after uninstalling this antivirus.

我怀疑在我的情况下,这是由隐藏的反恶意软件防病毒 Bytefence 引起的(可能,它与其他东西捆绑在一起)。卸载此防病毒软件后问题消失了。

回答by Martijn Lemmens

You can change the Storage Engine so you don't have to replace settings. If you set it to InnoDByou're problem sould be solved. ( Changing it can be don in the operations tab in phpmyadmin)

您可以更改存储引擎,因此您不必替换设置。如果您将其设置为InnoDB,那么您的问题就可以解决。(可以在 phpmyadmin 的操作选项卡中更改它)