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 database password modification

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

Share

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

This method can be used for unknown database password or initial login:

If you are changing the password, stop the mysql service first.

Systemctl stop mysqld

1 modify the configuration file and skip the password to enter the database

Vim / etc/my.cnf

[mysqld]

Skip-grant-tables

Restart the service:

Systemctl restart mysqld

Enter the database:

Mysql

View the database table structure:

Desc mysql.user

Set database login password

Update mysql.user set authentication_string=password ("123456")

Quit

Quit

Modify the configuration file again, comment out the skipped password, and write two more lines

[mysqld]

# skip-grant-tables

Validate_password_policy=0

Validate_password_length=6

Restart the service

Systemctl restart mysqld

Log in to the database with the set password

Mysql-uroot-p123456

Show databases

At this point, the user is required to write the password again.

Set password for root@localhost=password ("123456")

Quit

Quit

Enter again

Mysql-uroot-p123456

The database can be used normally:

Show databases

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