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

How to operate DCL in mysql database

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you the relevant knowledge points about how to operate DCL in mysql database. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.

DCL

DCL (Data Control Language), database control language.

Main purpose: an instruction to control database access.

Manipulate commands: GRANT, REVOKE

GRANT: empower users.

REVOKE: reclaims user rights.

User management

The post-MYSQL8.0 version does not support the grant statement to create users directly, so you need to create users before authorizing them.

Create user CREATE USER 'username'@'hostname' IDENTIFIED BY' password

Case study:

Create user 'csg1' identified by' 123'

Users created with Create have only the system default permission usage and no other permissions.

Delete user DROP USER 'username'@'hostname'

Case study:

Drop user csg1

Rights management entitles GRANT priviledge_name [(list_name1,list?_name2)] ON dbname.table_name FROM 'username'@'hostname'

Case study:

Add the 'select' permission for all tables in the database' mysqlpractice' to the account 'csg1'.

Grant select on mysqlpractice.* to csg1

Case study:

Entitle all permissions to the entire database and table.

Grant all on *. * to dba@localhost; View permissions to view specified account permissions:

SHOW GRANTS FOR 'username'@'hostname'

View the current user's own permissions:

SHOW GRANTS; Recycling permission REVOKE priviledge_name [(list_name1,list?_name2)] FROM dbname.table_name FROM 'username'@'hostname'

Case study:

Revoke select on mysqlpractice.* from csg1

These are all the contents of the article "how to operate DCL in mysql database". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Internet Technology

Wechat

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

12
Report