MySQL CREATE database user, permission settings

Source: Internet
Author: User
Tags mysql create mysql create database

Create database User Add permissions
category Detailed Solution
Basic syntax Grant permissions on library. Table to ' user ' @ ' host ' identified by ' password ';
Example Grant SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 ';
Example description Give the Liwenkai user permission to connect all tables in the test library natively. These tables of operations have query and write permissions

Note: You can add multiple permissions for one user.

Delete permissions
category Detailed Solution
Basic syntax Revoke permissions on library. Table from ' user ' @ ' host ';
Example Revoke SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 ';
Example description Give the Liwenkai user permission to connect all tables in the test library natively. These tables of operations have query and write permissions
Parameter description
symbols Description
Grant All After Grant, all instructions are given to grant all permissions
Revoke all After revoke all instructions to remove all permissions
Permissions on . . The permissions that are given to all tables in all libraries
' User ' @ ' host ' If the host is%. Hosts from any source can use this user to access

Create database user Liwenkai with all Select/insert permissions on the test database

Example: Increasing permissions

Mysql> Grant SELECT, insert on test.* to ' liwenkai ' @ ' localhost ' identified by ' 4311 ';
Query OK, 0 rows Affected (0.00 sec)

Example: Removing Permissions

Mysql> revoke insert on test.* from ' Liwenkai ' @ ' localhost ';
Query OK, 0 rows affected (0.30 sec)

Note:
Some of the above statements use less. You can set the mastery level of the knowledge point to understand the level.
More often, there are more permissions to set up, and people tend to remember specific commands. More often, people use specialized tools to manipulate permissions.

Transferred from: http://www.php.cn/code/4711.html

MySQL CREATE database user, permission settings

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.