Instances that grant MySQL user permissions

Source: Internet
Author: User

How does MySQL user permission be granted to users? Next let's take a look at the process of granting MySQL user permissions together with an instance.

Instance granted MySQL user permissions:
Mysql> grant select, insert, update, delete on test. user to mql @ localhost identified by '000000 ′;
Grant the local user mql the select, insert, update, and delete permissions on the user table of the database test, and set the password to 123456. If the mql user does not exist, the user will be automatically created. The specific permissions can be viewed in the mysql. db table. You can also directly update the table to modify the permissions.

Mysql> grant all privileges on test. * to mql @ localhost identified by '000000 ′;
Grant the local user mql the permission to perform all operations on all tables in the database test and set the password to 123456.

Mysql> grant all privileges on *. * to mql @ localhost identified by '000000 ′;
Grant the local user mql the permission to perform all operations on all tables in all databases, and set the password to 123456.

Mysql> grant all privileges on *. * to mql2@61.127.46.128 identified by '000000 ′;
User mql2 from 61.127.46.128 is assigned the permission to perform all operations on all tables of all databases, and the password is set to 123456.

REVOKE
REVOKE is opposite to GRANT in syntax format:
REVOKE privileges ON database name [. Table name] FROM user_name

For example:
Create user Bob with the password "bob", but do not grant him any permissions:
GRANT usage on * to Bob identified by 'bob ';
Grant Bob the query and insert permissions in the books database:
GRANT select, insert on books. * to Bob;
Cancel all Bob's permissions in the books database:
REVOKE all on books. * from Bob;
Note: REVOKE all... only revokes user permissions and does not delete users. In MySQL, User information is stored in mysql. User. MySQL can use drop user to completely delete a USER. Its usage is as follows:
Drop user user_name;
For example, to delete user Bob, you can use:
Drop user Bob;
 

Eight things to pay attention to in MySql Indexes

Differences between single-column and combined indexes in MySQL

Implement ADO connection to MYSQL

How to Create a MySQL Stored Procedure

Introduction to mysql trigger new old

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.