
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
MySQL appears to DROP USER but user still exists in MySQL.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)
- Related Articles
- Check if a user exists in MySQL and drop it?
- Solve ERROR 1396 (HY000): Operation DROP USER failed for 'user'@'localhost' in MySql?
- Drop trigger if exists in MySQL?
- How to update User Logged in Time for a specific user in MySQL?
- Set user-defined variable with table name in MySQL prepare statement?
- Show a MySQL user-defined variables values in the result table?
- How to check if a user email already exists in Laravel?
- Can we use the word user for a MySQL table?
- Can we convert MD5 to SHA256 in a MySQL table with user password column?
- Using User-Defined Variables in MySQL
- Display all grants for user in MySQL
- How to use user variables in MySQL LIKE clause?
- User Requirement and User Story in Agile
- How can we change MySQL user password by using the ALTER USER statement?
- MySQL CREATE USER with a variable?

Advertisements