Home  >  Article  >  Database  >  Linux下MySql出现#1036 – Table ‘ ‘ is read only 错误解决方_MySQL

Linux下MySql出现#1036 – Table ‘ ‘ is read only 错误解决方_MySQL

WBOY
WBOYOriginal
2016-05-31 08:47:471141browse

这两天在进行网站搬家,这次网站搬家采用直接打包mysql数据库和网页文件的形式进行迁移,上传好mysql data目录里面的网站数据库至VPS上mysql存放数据库的目录里面,解压就行。我的VPS存放数据库的路径是 /usr/local/mysql/var。

上传好网站数据,解压,配置好数据库链接参数就行,网站就能正常连接上了,我本以为这已 经是顺利迁移完成了,但后来操作的时候,发现只能读取数据库的内容,不能更改写入任何信息,提示#1036 – Table ‘* ‘ is read only (*号为任意表),也就是说表只有只读属性。

通过SSH,给数据库文件777权限,admin是我的数据库文件夹

1、chmod -R 0777 /usr/local/mysql/var/admin/

给数据库目录的所属用户和组改为MySQL

2、

chown -R mysql:mysql admin

但是这样还不能更改数据库,首先,找到mysqladmin所在位置,一般都在mysql/bin下面,我的在/usr/local/mysql/bin 里面,还需要运行以下命令:

3、./mysqladmin -u root -p flush-tables

之后输入root账号的密码,马上就好了,没有任何任何提示,然后测试一下,能正常读写,搬家也就顺利完成。

转:http://zhaoxiaoru39.blog.163.com/blog/static/609552192012511104730115/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn