Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql study notes (7-DCL commands user account and rights management)

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

User account and rights management:

User account: 'username'@'host'

Host: which hosts are allowed to remotely create connections when this user accesses the current mysql server

Representation: IP, network address, hostname, wildcard characters (% and _)

Do not check hostname: my.cnf

[mysqld]

Skip_name_resolve = ON

Create a user account:

CREATE USER 'username'@'host' [IDENTIFIED BY' password']

Delete user account:

DROP USER 'user'@'host' [, user@host]...

Authorization:

Permission levels: administrative 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 of all libraries

Db_name.*: specifies all tables of the library

Db_name.tbl_name: specify a specific table for the library

Db_name.routine_name: specify a stored procedure or stored function on the library

[object_type]

TABLE

FUNCTION

PROCEDURE

View the authorization granted to 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 authorization tables of the mysql library are read into memory

(1) permission operations performed by GRANT or REVOKE commands are saved in the table. MariaDB usually rereads the authorization table automatically, and the permission modification takes effect immediately.

(2) for permission modifications implemented in other ways, you must run the FLUSH PRIVILEGES command manually to take effect.

Hardening the mysql server and running the mysql_secure_installation command after the installation is complete

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report