Dave's Brain

Browse - Computer Tips - How do I create, list and delete users?

Date: 2011may16
Product: mysql

Q.  How do I create, list and delete users?

A.  Create a user:

GRANT ALL PRIVILEGES ON *.* TO the_user@localhost IDENTIFIED BY 'the_password';
Replace the_user and the_password. Watch out... even if you have done a "USE database" this command applies to all database on your mysql server. So a good practice is to prefix the userid with the database name: eg customers_smith. To List users:
select user from mysql.user;
With details:
select * from mysql.user;
Delete a user:
drop user the_user;
delete from mysql.user WHERE user='the_user'

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.