mysql Table is read only 的问题

今天导入数据库遇到了这个问题,总结下解决方案:

1.改可执行权限

1
chmod -R 777  /var/lib/mysql/ssbc2/

2.该用户组

1
chown root: -R /usr/lib/mysql/ssbc2

3.flush tables

1
mysqladmin -u root -p flush-tables

ok,问题解决


MySQL允许远程访问

如果mysql没有设置允许远程访问时进入远程访问就会报错:

1
_mysql_exceptions.OperationalError: (1130, "Host 'x.x.x.x' is not allowed to connect to this MariaDB server")

就要修改mysql数据库的访问权限:

1
2
3
4
5
6
mysql>use mysql;
mysql>update user set host = '%' where host ='root';
MariaDB [mysql]> update user set host = '%' where host = 'localhost';
mysql>flush privileges;
mysql> select host, user from user;
mysql>quit

当然不用了也要改回去了:

1
2
mysql>update user set host = 'localhost'  where host ='%';
MariaDB [mysql]> update user set host = 'localhost' where host = '%';