MySQL authorization and revocation Authorization for remote users

Source: Internet
Author: User
Tags mysql view

1. mysql View user

Mysql> select User,host,password from Mysql.user;


2. mysql Password change

mysql> Update mysql.user set Password=password ("Anonymous") where user= "root" and host= " localhost "; (set new password)

mysql> flush privileges; (refresh)


3. mysql Grant remote login permission for root

GRANT all privileges on * * to ' root ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;


4. View the storage type

Show varibales like ' storage_engine% ';


5. View the details of the new table

Mysql> Show CREATE TABLE it_salary;


6. View permission information for authorized users

Format:

Show grants for user name @ "Client Address";

Mysql> Show grants for [email protected] "192.168.4.%";

Command format:

Grant permission list on database name to user name;

Grant permission list on database name to user name; (the address specified can be linked)

Grant permission list on database name to username @ Client address identified by "password" (specified address, and enter password to link)

Grant permission list on database name to user name @ client address identified by "password" with GRANT option; (Authorized users can authorize other users)

Example:

Grant all on * * to [email protected];

Grant Select on userinfo.* to [e-mail protected] identified by ' 123456 ' with GRANT option;

Grant Select,insert,update (name) on Studb.t1 to Hydra;


7. Revoke User Rights

Format:

Revoke permissions list on database name from user @ "client address";

Instance:mysql> revoke insert on USERINFO.T1 from [email protected] "192.168.4.254";

Revoke User authorization rights: (You can revoke permissions only if you have explicitly authorized the library)

Format:

Revoke grant option on database name from user name @ "Client Address";

Example:mysql> revoke grant option on userinfo.* form [email protected] "192.168.4.254";

Revoke the specified permission:

Format: Revoke permissions list on database name from user name @ "Client Address";

Instance:mysql> revoke Delete on userinfo.* form [email protected] "192.168.4.254"; (Revoke delete permission)


MySQL authorization and revocation Authorization for remote users

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.