In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will share with you about the command to delete the mysql user group. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Delete the command for the mysql user group: 1. "DROP USER user 1 [, user 2]..." Command; 2. "DELETE FROM mysql.user WHERE Host='hostname' AND User='username';" command.
In the MySQL database, you can use the DROP USER statement to delete the user, or you can delete the user and related permissions directly in the mysql.user table.
1. Use the DROP USER statement to delete a normal user
The syntax for deleting a user using the DROP USER statement is as follows:
DROP USER [,]...
Among them, the user is used to specify the user account to be deleted.
The following points should be noted when using DROP USER statements:
The DROP USER statement can be used to delete one or more users and revoke their permissions.
You must have DELETE permission or global CREATE USER permission for the mysql database to use the DROP USER statement.
In the use of the DROP USER statement, if the hostname of the account is not explicitly given, the hostname defaults to "%".
Note: users' deletions do not affect their previously created tables, indexes, or other database objects, because MySQL does not record who created these objects.
Example 1
Let's delete the user 'test1@'localhost' using the DROP USER statement. The SQL statement and execution procedure are as follows.
Mysql > DROP USER 'test1'@'localhost';Query OK, 0 rows affected (0.00 sec)
In the cmd command line tool, use the test1 user to log in to the database server and find that the login failed, indicating that the user has been deleted, as shown below.
C:\ Users\ USER > mysql-h localhost-u test1-pEnter password: * ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: YES)
two。 Use the delete statement to delete a normal user
You can use the DELETE statement to delete the corresponding user information directly from the mysql.user table, but you must have DELETE permission for the mysql.user table. The basic syntax format is as follows:
DELETE FROM mysql.user WHERE Host='hostname' AND User='username'
Both the Host and User fields are the primary keys of the mysql.user table. Therefore, the values of two fields are required to determine a record.
Example 2
Let's delete the user 'test2'@'localhost' using the DELETE statement. The SQL statement and execution process are shown below.
DELETE FROM mysql.user WHERE Host='localhost'AND User='test2';Query OK, 1 rows affected (0.00 sec)
The results show that the deletion was successful. You can use the SELETE statement to query the mysql.user table to determine whether the user has been deleted successfully.
Thank you for reading! This is the end of the order to delete the mysql user group. I hope the above can be helpful to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.