Drop user in MySQL / MariaDB

Delete and disconnect the user in MySQL / MariaDB

Drop user in Mysql has one thing if we fire the drop command then the command is executed successfully but it allows us to run the existing connected session until they disconnected. To remove the drop user session, you have to kill them.

Check the user present in MySQL:

 select user,host from MySQL.user;

Drop user in MySQL

SYNTAX:
DROP USER [IF EXISTS] user@host;

Example:
drop user 'user2'@'%';

Kill the connected session for the drop User:

-- Check the list of process running
SHOW PROCESSLIST;

--Kill with the following command by using id:
KILL Id;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.