How to solve the problem of not finding the password after decompressing the MySQL free installation version

How to solve the problem of not finding the password after decompressing the MySQL free installation version

1. Unzip mysql-8.0.21-winx64
2. Configure environment variables and write the address to the bin folder

insert image description here

3. Create a configuration file named my.ini with the following content

[mysql]
# Set the default character set of the mysql client to default-character-set=utf8 
[mysqld]
interactive_timeout=28800000
wait_timeout=28800000
# Set port 3306 port = 3306 
# Set the installation directory of mysql basedir=D:\ProgramFiles\mysql-8.0.21-winx64\bin
# Set the storage directory of mysql database data datadir=D:\ProgramFiles\mysql-8.0.21-winx64\data
# Maximum number of connections allowed max_connections=200
# Set the default character set of MySQL server character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB

4. Install mysql service and enter

mysqld –install 

insert image description here

If the following error is reported, select "Open as administrator" when opening the cmd.exe program.

insert image description here

5. Initialize mysql and enter the following command. A data folder will be generated under the mysql directory.

mysqld --initialize 

insert image description here

If the data folder is not generated, use the following command

mysqld --initialize-insecure --user=mysql

6. Start mysql and set the password

net start mysql
mysql admin -u root -p password 

insert image description here

Failed to set the password. I searched Baidu and found that someone else's document mentioned opening the data folder in the root directory of MySQL, finding the file with the suffix .err, opening it as text, finding the temporary password (you can search with ctrl+f), and then entering the temporary password in cmd. However, there is no password in the .err file here, so I use the method of resetting the password.

7. If the mysql service is started, stop the mysql service using the command

net stop mysql

8. Using mysqld –skip-grant-tables has been tested to be invalid in mysql8.0.21. Now use the following command to enter the password-free login mode

mysqld --console --skip-grant-tables --shared-memory 

insert image description here

9. Open another cmd window and log in directly using mysql without a password. Enter the following command and press Enter. When prompted to enter the password , press Enter again to enter

mysql -uroot -p

10. Select the database and enter

use mysql 

insert image description here

11. Leave the password blank

update user set authentication_string='' where user='root';

12. If the prompt is successful, be sure to use the following command and then exit

flush privileges;
exit;

13. Close the cmd window in password-free login mode and start the MySQL service

net start mysql

14. The password in step 12 has been left blank, so log in to MySQL without a password and enter the login command:

mysql -u root -p

15. Change password

alter user 'root'@'localhost' identified with mysql_native_password BY '123456';

16. Refresh permissions and exit, you are done

flush privileges;
exit;

This is the end of this article about how to deal with the problem of not finding the password after decompressing the MySQL free installation version. For more information about the MySQL free installation version, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • MySQL free installation version (zip) installation and configuration detailed tutorial
  • Installation and configuration tutorial of MySQL 8.0.16 under Win10
  • MySQL 8.0.13 free installation version configuration tutorial under Windows environment
  • MYSQL8.0.13 free installation version configuration tutorial example detailed explanation
  • MySQL 5.7.20 free installation version configuration method graphic tutorial
  • MySql 8.0.11-Winxp64 (free installation version) configuration tutorial
  • Tutorial on configuring and changing passwords for the MySQL free installation version

<<:  Detailed explanation of the use of $emit in Vue.js

>>:  Implementation of LNMP for separate deployment of Docker containers

Recommend

Several ways to encrypt and decrypt MySQL (summary)

Table of contents Written in front Two-way encryp...

How to set background blur with CSS

When making some pages, in order to make the page...

JavaScript to implement voice queuing system

Table of contents introduce Key Features Effect d...

How to create a Pod in Kubernetes

Table of contents How to create a Pod? kubectl to...

How to configure the Runner container in Docker

1. Create a runner container mk@mk-pc:~/Desktop$ ...

HTML uses canvas to implement bullet screen function

Introduction Recently, I needed to make a barrage...

Common rule priority issues of Nginx location

Table of contents 1. Location / Matching 2. Locat...

A simple tutorial on how to use the mysql log system

Table of contents Preface 1. Error log 2. Binary ...

Vue shuttle box realizes up and down movement

This article example shares the specific code for...

Use pure CSS to achieve scroll shadow effect

To get straight to the point, there is a very com...

Detailed explanation of Zabbix installation and deployment practices

Preface Zabbix is ​​one of the most mainstream op...

Simple Implementation of HTML to Create Personal Resume

Resume Code: XML/HTML CodeCopy content to clipboa...