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

Mysql creates a case of ordinary root users and modifies and deletes functions

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

Share

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

Mysql creates a case of ordinary root users and modifies and deletes functions? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Method 1: use the SET PASSWORD command

Mysql-u root mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')

Method 2: use mysqladmin

Mysqladmin-u root password "newpass"

If root has already set a password, use the following methods

Mysqladmin-u root password oldpass "newpass"

Method 3: edit the user table directly with UPDATE

Mysql-u root mysql > use mysql; mysql > UPDATE user SET Password = PASSWORD ('newpass') WHERE user =' root'; mysql > FLUSH PRIVILEGES

Create a normal user

User management

Mysql > use mysql

View

Mysql > select host,user,password from user

Create

Mysql >

User management

Mysql > use mysql

View

Mysql > select host,user,password from user

Create a user

Mysql > insert into mysql.user (Host,User,Password) Values ('%', 'wise',PASSWORD (' passwd')); msyql > FLUSH RPIVILEGES

Modify

You can use mysql > rename user feng to newuser;//mysql 5 later. You need to update the user table using update before.

Delete

When deleting a user before mysql > drop user newuser; / / mysql5, you must first use revoke to delete the user rights, and then delete the user. After mysql5, the drop command can delete the user while deleting the relevant permissions of the user.

Change password

Mysql > set password for zx_root = password ('xxxxxx'); mysql > update mysql.user set password=password (' xxxx') where user='otheruser'

View user permissions

Mysql > show grants for zx_root

Grant authority

Mysql > grant all privileges on YQ.* to wise

Reclaim permission

Mysql > revoke select on dmc_db.* from zx_root; / / an error will be reported if the permission does not exist

Modify

You can use mysql > rename user feng to newuser;//mysql 5 later. You need to update the user table using update before.

Delete

When deleting a user before mysql > dropuser newuser; / / mysql5, you must first use revoke to delete the user rights, and then delete the user. After mysql5, the drop command can delete the user while deleting the relevant permissions of the user.

Change password

Mysql > set password for zx_root = password ('xxxxxx'); mysql > update mysql.user set password=password (' xxxx') where user='otheruser'

View user permissions

Mysql > show grants for zx_root

Grant authority

Mysql > grant select on dmc_db.* to zx_root

Reclaim permission

Mysql > revoke select on dmc_db.* from zx_root; / / if the permission does not exist, an error will be reported. Thank you for reading! After reading the above, do you have a general understanding of mysql's case of creating ordinary root users and modifying and deleting features? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to 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