时间:2021-07-01 10:21:17 帮助过:1人阅读
创建一个dumper用户它只能通过本机的回环网卡连接到mysql数据库
create user dumper@‘127.0.0.1‘ identified by ‘123@456‘;
3、grant 语句用来授权、权限是分层级的通常来说有实例级,数据库级,表级,列级;如果一用户有实例级别的select 权限,自然它也就有了数据库级,表级,列级的权限。
GRANT priv_type [(column_list)] [, priv_type [(column_list)]] ... ON [object_type] priv_level TO user_specification [, user_specification] ... [REQUIRE {NONE | tsl_option [[AND] tsl_option] ...}] [WITH {GRANT OPTION | resource_option} ...] GRANT PROXY ON user_specification TO user_specification [, user_specification] ... [WITH GRANT OPTION] object_type: { TABLE | FUNCTION | PROCEDURE } priv_level: { * | *.* | db_name.* | db_name.tbl_name | tbl_name | db_name.routine_name } user_specification: user [ auth_option ] auth_option: { IDENTIFIED BY ‘auth_string‘ | IDENTIFIED BY PASSWORD ‘hash_string‘ | IDENTIFIED WITH auth_plugin | IDENTIFIED WITH auth_plugin AS ‘hash_string‘ } tsl_option: { SSL | X509 | CIPHER ‘cipher‘ | ISSUER ‘issuer‘ | SUBJECT ‘subject‘ } resource_option: { | MAX_QUERIES_PER_HOUR count | MAX_UPDATES_PER_HOUR count | MAX_CONNECTIONS_PER_HOUR count | MAX_USER_CONNECTIONS count }
授予一个用户所有权限:
这里有几个地方是要注意的
1、all 权限并不包涵grant option 权限。
2、all 权限也不包涵proxy 权限,并且proxy 的权限的层级是user级的
grant all on *.* to dumper@‘127.0.0.1‘; grant grant option on *.* to dumper@‘127.0.0.1‘; grant proxy on ‘root‘@‘localhost‘ to dumper@‘127.0.0.1‘;
MySQL用户管理语句001
标签: