MySQL add user and user rights

Source: Internet
Author: User

MySQL Add user
Log in to MySQL using a user name that can operate on the MySQL database user table
Insert into User (Host,user,password) values ('% ', ' name ', ' Password ');
If the work user does not have permission to log on,
Killall mysqld
Share/mysql/mysql.server start
Grant all on * * to [e-mail protected] '% ' identified by ' password ';



The simple format of the command that MySQL gives the user permission is
Grant permissions on database object to user
Grant permissions on database object to user identified by "password"

User name: AD, Password: ad_pass, login ip:192.168.0.10
User permissions on all landed IPs
Grant all on * * to [e-mail protected] '% ' identified by ' ad_pass ';

Open Manage permissions for all databases in MySQL
Grant all on * * to [e-mail protected] ' 192.168.0.10 ' identified by "Ad_pass";

Open to manage permissions for specific databases (test) in MySQL
Grant all privileges on test to [e-mail protected] ' 192.168.0.10 ' identified by ' ad_pass ';
Or
Grant all on the test to [e-mail protected] ' 192.168.0.10 ' identified by "Ad_pass";

Open Manage permissions for tables (TEST.TABLE1) in a specific database in MySQL
Grant all on Test.table1 to [e-mail protected] ' 192.168.0.10 ' identified by ' Ad_pass '

Open Manage permissions for partial columns of a database-specific table (TEST.TABLE1) in MySQL
Grant Select (Id,se,rank) on Test.table1 to [e-mail protected] ' 192.168.0.10 ' identified by ' ad_pass ';

Open management Operations directives
Grant Select,insert,update,delete on test.* to [e-mail protected] ' 192.168.0.10 ' identified by ' ad_pass ';

Reclaim Permissions
Revoke all on * * from [email protected];

View MySQL user rights
Show grants;
Show grants for [email protected];

MySQL add user and user rights

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.