13.09.2023

How To Remove or Delete a MySQL User Account?

Introduction

In the modern infrastructure of IT—product, we should use system for operating data: get, pull, update, save, restore and more. For that purpose we can use software which can suggest popular Excel, MySQL, PostgreSQL and etc, but what is the difference between that product?

There exist several compelling rationales for employing databases, even when alternatives such as Excel are available.

In summary, databases provide a multitude of advantages over Excel in terms of scalability, performance, security, reliability, flexibility, and integration. If you need to store and manage substantial volumes of data or prioritize data security and dependability, opting for a database is the superior choice. In that instruction we will consider base action for admin: drop user.

Action for deletion

We will look at the MySQL like already installed software database with admin permission. Firts of all, we need to login into the MySQL system by typing command below:

mysql -u root -p -h localhost

Screenshot №1 — Login

Let's check current state of user in our database system by the command below:

SELECT user, host FROM mysql.user;

And we can see result below, please highlight spelling of syntax in the DBMS, in many of tutorials you can see how to authors write SELECT or SHOW by the capital letters. But it's no matter what type of writing you use SELECT or select. The names of databases, tables and columns depend on the case. Be aware at the moment of typing query. However, we can see table  with our created users.

Screenshot №2 — All users

Let's remove privileges and delete account from DBMS by the two command below:

revoke all on *.* from 'ff'@'localhost';

Screenshot №3 — Revoke

And then type that command for deletion account after revoke permission:

drop 'ff'@'localhost';

Screenshot №4 — Drop

Conclusion

In that instruction we have learned how to delete user in MySQL DBMS! It's important in the evolving landscape of IT, understanding the distinctions between data management tools becomes crucial, ensuring that the right choice is made to meet specific business needs and objectives.