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

What is the deletion and addition of mysql users and the authorization?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article is to share with you about the deletion and addition of mysql users and authorization, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1) Delete user

Delete from user where user='sss' and host='localhost'

Drop user sss

Flush privileges

2) add new users

CREATE USER 'user_name'@'host' IDENTIFIED BY' password'

User_name: the name of the user to be created.

Host: indicates which machine the newly created user is allowed to log in from. Enter 'localhost'' if only local login is allowed, or'%'if remote login is allowed

Password: the login database password of the newly created user. If you don't have a password, you don't have to write it.

=

For example, CREATE USER 'chunilla'@'%' IDENTIFIED BY' chunillachunilla'

3) authorized users

Command: GRANT privileges ON databasename.tablename TO 'username'@'host'

Privileges: indicates what authority to grant, such as select, insert, delete,update, etc. Enter ALL if all powers are to be granted

Databasename.tablename: indicates which table in which library the user's permissions can be used. If you want the user's permissions to have a special effect on all tables in all databases, fill in., * is a wildcard, indicating all.

'username'@'host': indicates the user to whom it is authorized.

=

For example, GRANT select ON circle.* TO 'chunilla'@'%'

These are the deletions and additions of mysql users and what the authorization is like. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow 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

Database

Wechat

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

12
Report