解决Column count of mysql.user is wrong. The table is probably corrupted问题

/ 0评 / 0

之前数据库从mariadb转到mysql,发现添加用户的时候会报错:Column count of mysql.user is wrong. The table is probably corrupted.原因是mariadb的用户表和mysql的用户表结构是不一样的,mariadb多了三个字段。把他们去掉之后mysql就会恢复正常。下面是代码,运行之前保存备份,并检查一下是否真的是多了这几个字段。

alter table user drop column is_role;
alter table user drop column default_role;
alter table user drop column max_statement_time;
alter table user modify max_user_connections int(11) unsigned NOT NULL DEFAULT '0';
flush privileges;

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注