MySQL User Appears Dropped but Exists in Users Table



First check all the user and host from MySQL.user table with the help of select statement as shown below

mysql> select user,host from MySQL.user;

The following is the output

+------------------+-----------+
| user             | host      |
+------------------+-----------+
| Bob              | %         |
| Manish           | %         |
| User2            | %         |
| mysql.infoschema | %         |
| mysql.session    | %         |
| mysql.sys        | %         |   
| root             | %         |
| @UserName@       | localhost |
| Adam Smith       | localhost |
| James            | localhost |
| John             | localhost |
| John Doe         | localhost |
| User1            | localhost |
| am               | localhost |
| hbstudent        | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
+------------------+-----------+
17 rows in set (0.00 sec)

Now, drop the user ‘hbstudent’ from MySQL.user table. The query is as follows −

mysql> drop user 'hbstudent'@'localhost';
Query OK, 0 rows affected (0.17 sec)

Now check the MySQL.user table to verify the user still exist in MySQL.user table or not. The query is as follows −

mysql> select user,host from MySQL.user;

The following is the output

+------------------+-----------+
| user             | host      |
+------------------+-----------+
| Bob              | %         |
| Manish           | %         |
| User2            | %         |
| mysql.infoschema | %         |
| mysql.session    | %         |
| mysql.sys        | %         |
| root             | %         |
| @UserName@       | localhost |
| Adam Smith       | localhost |
| James            | localhost |
| John             | localhost |
| John Doe         | localhost |
| User1            | localhost |
| am               | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
+------------------+-----------+
16 rows in set (0.00 sec)
Updated on: 2019-07-30T22:30:25+05:30

144 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements