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

[pure practical information, tips] how to forget the MySQL user password?

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

What if I forget the MySQL user password?

In the information society, the full and effective management and utilization of all kinds of information resources is the prerequisite for scientific research and decision management. Database technology is the core part of all kinds of information systems, such as management information system, office automation system, decision support system and so on. it is an important technical means for scientific research and decision management.

The database itself can be regarded as an electronic filing cabinet-the place where electronic documents are stored. Users can add, intercept, update, delete and other operations on the data in the documents.

A database refers to a collection of data that is stored together in a certain way, can be shared by multiple users, has as little redundancy as possible, and is independent of the application.

Even if it is a database, then there will be data management users who manage data, and users will have passwords, and sometimes they will inevitably encounter the situation of forgetting the passwords of administrative users, so what if the user's password is accidentally lost?

The following is to introduce you to a way to forget MySQL user passwords:

First of all, we usually log in to MySQL as follows

[root@bogon] # mysql-u root-p

Enter password: / / enter the password here

Mysql > / / you can log in to the MySQL database normally.

But what if I forget the password?

Don't panic!

Let's simulate the experiment:

First, stop the MySQL service and check whether the MySQL ends

[root@bogon ~] # systemctl stop mysqld.service [root@bogon ~] # netstat-ntap | grep 3306 / you can see that there are no service processes on port 3306.

Skip password verification and log in to MySQL

[root@bogon ~] # mysqld-- skip-grant-tables; / / restart a terminal when you skip password verification, log in to MySQL [root@bogon ~] # mysql-u root / / to log in MySQLmysql > / / you can see that you have logged in to MySQL and then change the password mysql > update mysql.user set authentication_string=password ('abc123') where user='root' / / change the password of root user to abc123Query OK, 1 row affected, 1 warning (0.01sec) Rows matched: 1 Changed: 1 Warnings: 1mysql > flush privileges / / refresh to make the new password setting take effect Query OK, 0 rows affected (0.00 sec) mysql > exit / / exit MySQLBye at this time we try to log in [root@bogon ~] # mysql-u root-p Enter password: / / enter abc123mysql > / / here to see the successful login

If you really accidentally forget your MySQL database user's password, I hope it can help you!

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