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)