mysql--User Management

Source: Internet
Author: User


Grant all on * * to ' user1 ' identified by ' passwd '

Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';

Grant all on db1.* to ' user3 ' @ '% ' of ' identified by ' passwd ';

Show grants;

Show grants for [email protected];

1.grant all on * * to ' user1 ' @127.0.0.1 ' identified by ' 123456 ';

Authorized to user1 this user all permissions,

127.0.0.1, which is the source IP, means that the MySQL can only be connected via this IP

* * This * is the library name

Then quit MySQL and log in using the following command:

mysql-uuser1-p123456-h127.0.0.1 #即可登录

Can be changed to localhost, you do not need to specify an IP login, as follows:

Grant all on * * to ' user1 ' @localhost ' identified by ' 123456 '; #则登录的时候直接 mysql-uuser1-p123456 can log in directly

Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';

Grant Select,update,insert on db1.* to ' user2 ' @ ' 192.168.133.1 ' identified by ' passwd ';

Show Grants\g;

Show grants for [email protected] ' 192.168.133.1 ';

There is a situation will be used, I give 192.168.133.1IP authorization, found not enough, but also to 192.168.133.2 on the re-authorization, you can do this:

Show grants for [email protected] ' 192.168.133.1 ';

Then copy the two sentences in the list, and note that both groups need to be duplicated because they are a group;

Then show grants for [email protected] ' 192.168.133.2; ' Then you can find one and 1 two segments.

mysql--User Management

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.