User settings and Authorization for MySQL

Source: Internet
Author: User

You can have 2 different ways to add users: by using the grant statement or by directly manipulating the MySQL authorization table. The better approach is to use the GRANT statement because they are more concise and seem to have fewer errors.

Display the user's authorization using the show grants statement

You can view the authorization form directly, or you can use the show grants statement to view the authorization of a user, which is obviously easier to use with the show grants statement.

Syntax: Show grants for USER_NAME

To accommodate the rights granted to users of any host, MySQL supports specifying user_name values in the User@host format.

For example, the following statement shows the permissions of a user admin:

Mysql>show grants for Admin@localhost;

The result is a Grnat authorization statement that creates the user:

GRANT RELOAD, SHUTDOWN, PROCESS on *.* to ' admin ' @ ' localhost ' identified by PASSWORD ' 28e89ebc62d6e19a '

A password is a form of encryption.

Use the GRANT statement to create a user and authorize

Syntax for Grant statements

GRANT priv_type (columns)

On what

To user identified by "password"

With GRANT OPTION

To use this statement, you need to fill in the following sections:

priv_type the permissions assigned to the user.

Priv_type can specify any of the following:

All Privileges FILE RELOAD

ALTER INDEX SELECT

CREATE INSERT SHUTDOWN

DELETE PROCESS UPDATE

DROP REFERENCES USAGE

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.