Computer Tips - mysql: create, list and delete users

Date: 2011may16 Product: mysql Language: sql Q. mysql: 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'