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 realize user Authorization in mysql

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

Share

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

Mysql in how to achieve user authorization, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Mysql user Authorization

By default, mysql is entered and operated by root users, so if you want to enter and add, delete, modify and query the database as other users, you need to enter the database as root users to authorize the corresponding users.

Server0:/usr/local/mysql/bin # mysql-uroot-p

Enter password:

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | solrclient |

| | test |

+-+

Mysql > grant all privileges on solrclient.* to identified by 'suse'

Query OK, 0 rows affected (0.00 sec)

Mysql > FLUSH PRIVILEGES

Query OK, 0 rows affected (0.00 sec)

Mysql >\ Q

There can also be finer-grained authorization:

/ / if you want to assign some permissions to a user, you can write as follows:

Mysql > grant select,update on solrDB.* to identified by 'suse'

3. Delete user

@ > mysql-u root-p

@ > password

Mysql > DELETE FROM user WHERE User='suse'and Host= "localhost"

Mysql > flush privileges

/ / delete the user's

> drop database solrDB

4. Modify the specified user password

@ > mysql-u root-p

@ > password

Mysql > update mysql.user set password=password ('new password') where User='suse' and Host= "localhost"

Mysql > flush privileges

Mysql > quit

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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