Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-05-31 17:30:59 09月18日 Update

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.

Tags: User login password data database more power authority knowledge article utility function name command that is work meeting article look knowledge point industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info vpn Apple OPPO Reno