MySQL:User Account Management


 * Home
 * Administration Tools
 * Backup and Restore
 * Security
 * User Account Management
 * Utility

It's critical to assign the correct privileges to user accounts. See the Security section of the wiki for best practices on assigning appropriate privileges. For more information on user account management follow the URL below.

http://dev.mysql.com/doc/refman/5.1/en/user-account-management.html

Grants and Privileges
You can use the “show grants;” and "show privileges;” commands to display the designated levels for users.

Privilege List and Explanations:



Creating Accounts
To create accounts log into mysql using either the root or another designated superuser account. Then use the create user and grant commands. Grant specifies the type of privilege levels associated with a user. To allow for remote access, add '%' after '@'.

Example:

mysql> create user 'admin'@'%' identified by 'mynewpassword';

mysql> create user 'admin'@'localhost' identified by 'mynewpassword';

mysql> grant all privileges on database_example.* to 'admin'@'%' identified by 'mypassword' with grant option;

mysql> grant all privileges on database_example.* to 'admin'@'localhost' identified by 'mypassword' with grant option;

Removing Accounts
You can simply use the drop user command to remove accounts.

Example:

mysql> drop user admin;

mysql> drop user admin if exists;