The Series of MySQL -2- MySQL User Management - EP 03_02
HI Hi, Greetings!
Happy January
Hi Everyone,
Today, I would like to share with you an article about the third episode of Series of MySQL (MySQL User Management), and the content is given below.
a. MySQL Create User
b. MySQL Drop User
c. MySQL Show Users
d. MySQL User Password Change
MySQL Drop User
We can use the MySQL Drop User statement to delete one or more user accounts from the database server, as well as their rights. It returns an error if the account doesn't exist on the database server.
You must have a global privilege of Create User statement or the DROP privilege for the MySQL system schema if you want to utilize the Drop User statement.
Sample Scenario:
Delete a user:
DROP USER 'account_name';
The account_name can be identified with the following command:
username@hostname
The username is the account name you want to remove from the database server, and the hostname is the user account's server name.
The steps for drop (delete) a new user in the MySQL server database are as follows.
Step 1: Open the MySQL server by using the mysql client tool.
Step 2: Enter the password for the account and press Enter.
Enter Password: ********
Step 3: Execute the following command to show all users in the current MySQL server.
mysql> select user from mysql.user;
Step 4: To drop a user account, you need to execute the following statement.
DROP USER ada@localhost;
The username 'ada' will be removed from the MySQL server in the above step. After the above command has been successfully executed, you must run the show user statement once more.
Step 5: You can also use the DROP USER statement to delete many user accounts at once. We can delete several user accounts by using the comma operator to separate account names. Execute the following command to erase numerous user accounts.
DROP USER ada@localhost, pet@localhost;
The ada and pet accounts will be removed from the above image. After the above command has been successfully executed, you must run the show user statement once more. If the usernames john and peter aren't present, you'll get the following output.
You are welcome to like and leave feedback in the comment area.
Link:
EP 03_01:
The Series of MySQL -3- MySQL User Management - EP 03_01
EP 03_03:
The Series of MySQL -3- MySQL User Management - EP 03_03
EP 03_04:
The Series of MySQL -2- MySQL User Management - EP 03_04
Source:
· https://www.w3schools.com/mySQl/default.asp
· https://www.mysqltutorial.org/mysql-basics/
M M Zaheer Hussain
Stay Safe!