Million annual salary python road - user permissions of MySQL database

MySQL user authorization

(From https://www.cnblogs.com/dong-/p/9667787.html)

A. The new user additions and deletions

  1. increase the user:

    ①. Specify a user to use a certain ip login and specify a password

      create user "用户名"@"192.168.1.1" identified by "123";

    ②. Ip specify a particular user logging into a network of

      create user "用户名"@"192.168.1. %" identified by "123";

    ③. Specify a particular user can use any ip login

      create user "用户名"@"%" identified by "123";

  2. Delete user

    drop user "username" @ "IP address";

  3. Modify the user

    rename user "username" @ "ip address" to "new user name" @ "IP address";

  4. Change Password  

    set password for "user name" @ "ip address" = password ( "New Password");

II. Of the current user is authorized root users can be authorized

  1. Check the permissions

    show grants for "user" @ "ip address";

  2. Authorizes a user to only a certain file has a certain operation

    grant select, insert, update on db1.b1 to "zcy" @ "%" authorized "zcy" Users can be performed at any ip on the table b1 db1 database query, add, change operation.

  3. authorize all permissions for a user, in addition to grant this order, grant command only root can be used.

    grant all privileges on db1.b1 to "zcy" @ "%"; zcy user can perform any operations on the table under b1 db1.

    grant all privileges on db1 * to "zcy" @ "%";. zcy user can perform any operations on the database db1 under any ip

    All privileges ON Grant . to "ZCY" @ "%"; ZCY user can perform any operations on any database in any ip

  4. deauthorize

    All ON REVOKE . from "user name" @ "%" Canceling all the permissions for a user of a

    revoke all on db1.b1 from "zcy" @ "%" to cancel all authorized users zcy b1 db1 under the table

    revoke select on db1.b1 from "zcy" @ "%" user queries cancel zcy authorized b1 db1 under the table

Guess you like

Origin www.cnblogs.com/zhangchaoyin/p/11426458.html