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

Under centos7, forget mysql2.5. Version of the login password, how to reset and login

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

Share

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

Forget the initial password

1. View the initial password

# grep 'temporary password' / var/log/mysqld.log

2. Log in with the initial password

# mysql-u root-p

3. Change the password

Mysql > ALTER USER 'root' IDENTIFIED BY' xxxxxxxxx'

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' xxxxxxxx'

4. Refresh the permission table

Mysql > flush privileges

5. Exit and restart

Mysql > exit

# service mysqld restart

Forget the modified password

Check if mysql is started, and if so, turn off mysql

/ / View mysql status

# ps-ef | grep mysql

# service mysql stop

Modify the configuration file my.cnf of mysql

In the / etc/my.cnf file, add 2 lines of code

[mysqld]

Skip-grant-tables

The function is to skip password verification when logging in to mysql

3. Start mysql and enter mysql

# service mysqld start

# mysql-u root

Modify the password

Connect to the mysql database and change the user's password

Mysql > use mysql

Mysql > update mysql.user set authentication_string=password ('123456') where user='root'

Mysql > flush privileges

Mysql > exit

Restart mysql

First comment or delete the 2 lines of code that have been added to the configuration file, then restart mysql, and you can log in with the password you just set.

# service mysql start

# mysql-u root-p

Enter password:

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

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report