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

How to solve the problem of MySQL8 forgetting password

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

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to solve the problem of MySQL8 forgetting your password. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Step 1: skip the permission table

Mysqld-skip-grant-tables

Step 2: leave the password empty

UPDATE user SET authentication_string='' WHERE user='root'

However, this scheme does not apply to MySQL8.

This article will solve the MySQL 8 forgotten password reset password problem in the future. It mainly includes three aspects.

Content 1: a brief introduction of decompressed installation of MySQL 8

Content 2: forget password reset password solution 1

Content 3: forget password reset password solution 2

One installation

1. Download the installation package on the official website (the official website provides two installation methods: visual installation and decompression). This example is based on decompression. Download address https://dev.mysql.com/downloads/mysql/ on the official website

two。 Unpack the installation package and put it in the C:\ MySQL directory

3. Configure environment variables

MySQL_HOME= "C:\ MySQL\ mysql-8.0.15-winx64"

PATH= "% MySQL_HOME%\ bin"

4. Open dos as an administrator

(1) start the service

Mysqld-install

(2) initialize and generate the initialization password (MySQL7+ does not have a data directory, initially install the data directory)

Mysqld-initialize-user=mysql-console

(3) start the service

Net start mysql

(4) Log in

Account root. The password is the temporary password generated in the initial message. (Ivw7xjQ, after logging in, it needs to be changed.

(5) change the root password

Format: alter user 'username' @ 'login host' identified by 'password (custom)'

(6) login with new password

(7) extension command

Remove service: mysql-- remove

Stop the mysql service: mysql stop mysql

Exit mysql:exit

Second, solve the problem of forgetting your password

(I) option 1

1. Enter dos as administrator

two。 Stop the mysql service

Net stop mysql

3. Start without password

Mysqld-console-skip-grant-tables-shared-memory

4. Open another dos window and log in without a password

5. Clear the password

Note: authentication_string uses plugin encryption, so it is set to empty, do not set to other values

6. Start the service

Close the two open dos windows, then reopen a dos window as an administrator to start the service

Net start mysql

7. Login without password

Mysql-u root

8. Reset password

After modification, you can log in with the new password.

9. Login with new password

(2) Plan 2: using the parameter-- init-file parameter

1. Out of Service

Net stop mysql

two。 Create a ResetPWD.txt file in the c:\ MySQL directory with the following contents

ALTER USER 'root'@'localhost' IDENTIFIED BY' 123456'

3. Execute ResetPWD.txt file

Mysqld-- init-file=c:\ mysql\ ResetPWD.txt-- console. After execution, close the dos window.

4. Start mysql

Net start mysql

5. Log in with a new password

After reading the above, do you have any further understanding of how to solve the problem of MySQL8 forgetting password? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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