Dave's Brain

Browse - computer tips - mysql create list 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;

Or:

	delete from mysql.user WHERE user='the_user'
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.
Advertisements: