MySQL security management and mysql Management
How to enter mysql under Dos
1. Go to the mysql installation directory
cd C:\Program Files\MySQL\MySQL Server 5.6\bin
2. User Login
mysql -hlochlhost -uabc -pabc
-H: indicates the server name. The lochlhost is the local machine.
-U: User Name
-P: password. If the user does not have a password, simply-p.
Create user
CREATE USER li@localhost IDENTIFIED BY 'li';
Grant all permissions of the user li database person and allow the user li to grant all permissions of the database person to other users
GRANT ALL ON PERSON.* TO li@localhost WITH GRANT OPTION;
Take effect immediately. If the granted permissions do not take effect, the following command will take effect after version 5.6 change.
FLUSH PRIVILEGES;
GRANT create user
If no user exists, GRANT can create a user when granting permissions.
Grant select and insert permissions to all tables of the user database person.
Grant select, insert on person. * TO 'abc' @ 'localhost' identified by 'abc ';
At the same time, run user abc to grant the SELECT and INSERT permissions of the person database to other users.
GRANT SELECT,INSERT ON PERSON.* TO 'abc'@'localhost' identified by 'abc' with grant option;
Exit current user
exit
View permissions of the current user
show grants;
View User abc Permissions
show grants for abc@localhost;
REVOKE permissions from REVOKE
Revoke the insert permission of user abc database person
REVOKE INSERT ON PERSON.* FROM abc@localhost;
Revoke permissions
Revoke all permissions of the person database abc revoke all on person. * FROM abc @ localhost; revoke all permissions of ALL databases of abc revoke all on *. * FROM abc @ localhost;
Delete a user
In earlier versions, users must be revoked before they can be deleted.
DROP USER abc@localhost;
Note: Author: pursuer. chen Blog: http://www.cnblogs.com/chenmh All essays on this site are original. You are welcome to repost them. However, you must indicate the source of the article and clearly provide the link at the beginning of the article. Otherwise, you will be held accountable. Welcome to discussion |