MySQL 错误 1036:表是只读的

2022-01-05 00:00:00 mysql phpmyadmin

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

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

#1036 - Table 'sch_portfolio' is read only 

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

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

drwxrwxrwx 2 mysql mysql     4096 Jul 13 15:27 schooltap

推荐答案

需要超级用户权限才能做到这一点,最常用的 sudo 就是用来实现这一点的.

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

为了也改变文件的所有者.

in order too Change the owner of the files.

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

重新启动Mysql以进行更改

Reboot Mysql for the changes

sudo service mysql restart

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

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

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

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

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

The MySQL server is running as user mysql and 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/mysql directory. The directory itself should also belong to ‘mysql’.

相关文章