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

Linux environment Mysql create new users and databases and authorize

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

Share

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

1. Log in to mysql

# mysql-u root-p

two。 New users

Insert into mysql.user (Host,User,Password) values ("localhost", "xxx", password ("*"))

Note: xxx is the new user name, and * * is the user password.

3. After executing this sentence, you also need to refresh the permission table

Flush privileges

4. Create a new database and grant user permissions

Create database dbtest

Full authorization:

Allow local login

Grant all privileges on dbtest.* to xxx@localhost identified by "*"

Allow any host to log in

Grant all privileges on dbtest. To xxx@'%' identified by ""

Partial authorization:

Grant select,update on dbtest.* to xxx@localhost identified by "* *"

5. Permission is granted, and the permission table needs to be refreshed.

Flush privileges

6. Query the new results through the sql statement

Select user,host,password from mysql.user

7. Delete user

Delete from user where user='xxx'

Flush privileges

8. Delete database

Drop database dbtest

9. Modify the password

Update mysql.user set password=password ('new password') where User='xxx' and Host='localhost'

Flush privileges

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