ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user' I am trying to grant privileges for a user to a new database

mysql&gt; grant all on db_test.* to 'user_test'@'localhost' identified by 'usersexistingpassword';


I get the following error

ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user'


I am using MySQL 5.6

mysql&gt; select @@version;
+-------------+
| @@version   |
+-------------+
| 5.6.24-72.2 |
+-------------+
1 row in set (0.00 sec)


I did find an article on MySQL on updating Native Passwords on 5.6.x and later


  6.3.9.3 Migrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin
  https://dev.mysql.com/doc/refman/5.7/en/account-upgrades.html


I ran the command they recommend as root

mysql&gt; UPDATE mysql.user SET plugin = 'mysql_native_password'
    -&gt; WHERE plugin = '' AND (Password = '' OR LENGTH(Password) = 41);
ERROR 1054 (42S22): Unknown column 'plugin' in 'where clause'
Your problem has to do with mysql.user and the way you upgraded to MySQL 5.6

If you look my answer to Cannot GRANT privileges as root, I show you the description of mysql.user from MySQL 4.1 to MySQL 5.6.

The column plugin is column #41 in mysql.user in MySQL 5.5/5.6

mysql&gt; SELECT column_name,ordinal_position FROM information_schema.columns
    -&gt; WHERE table_schema='mysql' and table_name='user' and column_name='plugin';
+-------------+------------------+
| column_name | ordinal_position |
+-------------+------------------+
| plugin      |               41 |
+-------------+------------------+
1 row in set (0.04 sec)

mysql&gt; SELECT version();
+-----------+
| version() |
+-----------+
| 5.6.24    |
+-----------+
1 row in set (0.02 sec)

mysql&gt;


That column does not appear in MySQL 5.1, 5.0 or 4.x. What this tells me is that somehow MySQL was upgraded to 5.6 but still has the mysql.user from 5.1 or older.

If you run SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user'; and you get 39, I have just the fix for you.

See my post MySQL service stops after trying to grant privileges to a user on how manually fix mysql.user from 5.1 straight to to 5.6.