MySQL Learning notes (7-User account and Rights Management)

Source: Internet
Author: User

User account and Rights management:

User account: ' username ' @ ' host '

Host: When this user accesses the current MySQL server, which hosts are allowed to remotely create the connection;

Representations: IP, network address, host name, wildcard (% and _);

Disable Check host name: MY.CNF

[Mysqld]

Skip_name_resolve = On

Create user account:

CREATE USER ' username ' @ ' host ' [identified by ' Password '];

Delete user account:

DROP user ' user ' @ ' host ' [, [email protected]] ...


Authorized:

Permission levels: Manage permissions, databases, tables, fields, storage routines;

GRANT Priv_type,... On [object_type] db_name.tbl_name to ' user ' @ ' host ' [identified by ' Password '];

Priv_type:all [Privileges]

Db_name.tbl_name:

*. *: All tables for all libraries;

db_name.*: Specifies all tables for the library;

Db_name.tbl_name: Specify a specific table for the library;

Db_name.routine_name: Specifies a stored procedure or storage function on the library;

[Object_type]

TABLE

FUNCTION

PROCEDURE

To view the authorizations obtained by the specified user:

SHOW GRANTS for ' user ' @ ' host '

SHOW GRANTS for Current_User;

Reclaim Permissions:

REVOKE Priv_type, ... On db_name.tbl_name from ' user ' @ ' host ';

Note: When the MARIADB service process starts, all the authorization tables from the MySQL library are read into memory;

(1) Permission actions such as GRANT or REVOKE command will be saved in the table, mariadb the authorization form will be automatically reread at this time, the permission modification will take effect immediately;

(2) Other ways to implement the permission modification, in order to be effective, you must manually run the flush privileges command can;

Harden the MySQL server and run the mysql_secure_installation command after the installation is complete;


This article is from the "Wang Liming" blog, make sure to keep this source http://afterdawn.blog.51cto.com/7503144/1925927

MySQL Learning notes (7-User account and Rights Management)

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.