Mysql创建用户报错:ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user'

     

     前几日,把公司的mysql数据库从5.16升级到5.6.27,今天要创建用户就报错了

mysql> create user qzwx identified by 'qzwx';
ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user'

    经排查,发现是5.16版本mysql.user表的没有plugin,而升级数据库的时候,mysql.user表没有升级,才导致字段缺少,可以通过以下方法修改mysql.user表:

 

mysql>use mysql;
mysql>ALTER TABLE user ADD Create_tablespace_priv ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER Trigger_priv; 
mysql>ALTER TABLE user ADD plugin CHAR(64) NULL AFTER max_user_connections; 
mysql>ALTER TABLE user ADD authentication_string TEXT NULL DEFAULT NULL AFTER plugin; 
mysql>ALTER TABLE user ADD password_expired ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER authentication_string;

 修改后就能正确创建用户了

    

mysql> create user 'qzwx'@'%' identified by 'qzwx';
Query OK, 0 rows affected (0.00 sec)

 

你可能感兴趣的:(mysql,error,mysql用户,1054)