Mysql delete user from mysql user11/19/2023 Sixth, select the people database: mysql> use people Code language: SQL (Structured Query Language) ( sql ) Type the password for the user account alice and press the Enter key: Enter password: ************ Code language: SQL (Structured Query Language) ( sql ) > primary key( id)) Code language: SQL (Structured Query Language) ( sql )įourth, grant all privileges on the people database to the account user alice: mysql> grant all privileges on people.* to Code language: SQL (Structured Query Language) ( sql )įifth, launch another session and connect to the database using the user mysql -u alice -p Code language: SQL (Structured Query Language) ( sql ) Third, create a new table persons in the people database: mysql> create table persons( Second, select the people database: mysql> use people Code language: SQL (Structured Query Language) ( sql ) Here is the output: + -+-+Ħ rows in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql ) C) Using MySQL DROP USER to drop a connected userįirst, create a new database called people: mysql> create database people Code language: SQL (Structured Query Language) ( sql ) Second, show users from the current database: mysql> select user, host from er B) Using MySQL DROP USER to drop multiple user accounts at onceįirst, remove two user accounts remote using the following statement: mysql> drop user remote The user account been removed successfully. Here is the current user list: + -+-+ĩ rows in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql )įourth, drop the user by using the DROP USER statement: mysql> drop user Code language: SQL (Structured Query Language) ( sql )įifth, show all users again: mysql> select user, host from er Ĭode language: SQL (Structured Query Language) ( sql ) + -+-+Ĩ rows in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql ) Third, show users from the MySQL Server: mysql> select user, host from er Code language: SQL (Structured Query Language) ( sql ) Second, create four account users accounts remote, and mysql> create user remote, identified by 'Secure1Pass!' Code language: SQL (Structured Query Language) ( sql ) Type the password for the root user and press Enter: Enter password: ******** Code language: SQL (Structured Query Language) ( sql ) A) Using MySQL DROP USER statement to drop a user exampleįirst, connect to the MySQL Server using the root account: mysql -u root -p Code language: SQL (Structured Query Language) ( sql ) Let’s take some examples of dropping users. Ĭode language: SQL (Structured Query Language) ( sql )īesides removing the user account, the DROP USER statement also removes all privileges of the user from all grant tables. In MySQL 5.7.8+, you can use the IF EXISTS clause to conditionally drop a user only if it exists: DROP USER account_name. If you remove a user account that doesn’t exist, MySQL will issue an error. Code language: SQL (Structured Query Language) ( sql ) ![]() ![]() If you want to remove multiple user accounts at once, you specify a list of comma-separated user accounts in the DROP USER clause: DROP USER account_name. ![]() In this syntax, you specify the name of the user account that you want to remove after the DROP USER keywords.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |