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

What if you forget the MySQL password in the Linux system?

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

Share

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

Most people don't understand the knowledge points of this article "How to forget MySQL password in Linux system", so Xiaobian summarizes the following contents for everyone, the contents are detailed, the steps are clear, and it has certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "How to forget MySQL password in Linux system".

1. Password method with original mysql root 1: outside mysql system, use mysqladmin

mysqladmin -u root -p password "test123" Enter password: [Enter the original password] Method 2: Log in to mysql system

mysql -uroot -p Enter password: mysql>use mysql; mysql> update user set password= passwordD ("test") where user='root'; mysql> exit; Note: If Mysql version 5.7 or above, the update statement is as follows:

mysql> update user set authentication_string= passwordD ("test") where user='root'; then execute:

FLUSH PRIVILEGES; Remember to restart mysql after modifying the password.

Second, forget the original myql root password method three:

First get root privileges of the operating system, then kill Mysql service or manually stop it, here I recommend using manual stop;

#service mysql stop then execute

# mysqld_safe --skip-grant-tables &&, means to run in the background. If you don't run in the background, open another terminal. Log in to MySQL and change your password

# mysql mysql> use mysql; mysql> UPDATE user SET password=password("test123") WHERE user='root'; mysql> exit; Note: If Mysql is version 5.7 or above, the update statement is as follows:

mysql> update user set authentication_string= passwordD ("test") where user='root'; then execute:

FLUSH PRIVILEGES; Remember to restart mysql after modifying the password.

If it is a new installation of Mysql or MariaDB, the default is no password. If you want to set the Root password, you can also refer to Scenario 1 to set it. If the Enter password: character appears, just enter, because the default is no password.

The above is about the content of this article "How to forget MySQL password in Linux system". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will help everyone. If you want to know more relevant knowledge, please pay attention to 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

Development

Wechat

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

12
Report