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

The method of how to reset password and assign New user Rights in mysql

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

Share

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

This article is mainly about how to reset passwords and assign new user rights in mysql. If you are interested, let's take a look at this article. I believe it is of some reference value to you after reading how to reset passwords and assign new user rights in mysql.

1. Reset the root password

1. Modify the configuration file and log in without secret

Enter the command to edit the file sudo vi etc/mysql/my.cnf (root users can do without sudo)

Edit the file and write to the configuration:

[mysqld] skip-grant-tables

Restart mysql after wq save and exit:

Sudo service mysql restart

Log in to mysql

Change the password:

UPDATE mysql.user SET authentication_string=PASSWORD ("123") WHERE user= "root"; flush privileges

Finally, exit and delete the code added by my.cnf, and then restart mysql and you are done.

Create a user and assign table permissions

Create a user

CREATE USER 'user2'@'localhost' IDENTIFIED BY' 123'

Create a tabl

Create database test

Assign permissions

Grant all privileges on test.* to user2@'%' identified by '123'

Refresh the system permissions table

Flush privileges

View permissions:

Show grants for 'user2'@'%'

Exit restart mysql

Are the above details about how to reset passwords and assign new user rights in mysql helpful? If you want to know more about it, you can continue to follow our industry information section.

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