Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method for mysql to delete a user?

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what is the method of deleting users by mysql, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

There are two ways for mysql to delete users: one is to use the drop statement, and the other is to use the delete statement.

Drop

Drop user XXX

Delete existing users, the default is' XXX'@'%' this user, if there are other users, such as' XXX'@'localhost', etc., will not be deleted together. If you want to delete 'XXX'@'localhost', you need to add host, that is, drop user' XXX'@'localhost' when you use drop to delete.

Delete

Delete from user where user='XXX' and host='localhost'

Where XXX is the user name and localhost hostname.

Difference

Drop deletes not only the data in the user table, but also the contents of other permissions tables. Delete only deletes the contents of the user table, so you need to perform FLUSH PRIVILEGES; refresh permissions after deleting a user using delete, otherwise an error will be reported the next time you create a user using the create statement.

!

Thank you for reading this article carefully. I hope the editor will share what the method of deleting users from mysql is helpful to everyone. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you have any problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report