Create Sub-permissions for mysql users

Source: Internet
Author: User

There is a need for a project: divide the table into permissions and divide them into different enterprises.

At that time, navicat was used to manually add the customer and divide the permissions. I don't know why I couldn't log on to the database. I still need to study it ..........

Later, my colleague song implemented it using the command line as follows:

Create a user:

Create user 'test1' @ '%' identified by 'test1 ';

Authorization: Assign the select permission on the table nb_acclist to test1.
Grant select on sync_users.nb_acclist to test1 @ '%' identified by 'test1 ';

View User Permissions:
Mysql> show grants for test1;
+ Shards +
| Grants for test1 @ % |
+ Shards +
| Grant usage on *. * To 'test1' @ '%' identified by password' * 06c0bf5b64ece2f648b5f048a74153906ba08e5c '|
| Grant select on 'sync _ users'. 'nb _ acclist' to 'test1' @ '%' |
+ Shards +

2 rows in SET (0.00 Sec)

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.