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

Detailed tutorial on replacing mysql8.0.17 in windows10

This article shares the specific steps of replaci...

How to restore data using binlog in mysql5.7

Step 1: Ensure that MySQL has binlog enabled show...

Beginners learn some HTML tags (3)

Related articles: Beginners learn some HTML tags ...

JavaScript function encapsulates random color verification code (complete code)

An n-digit verification code consisting of number...

MySQL 8.0.14 installation and configuration method graphic tutorial (general)

MySQL service 8.0.14 installation (general), for ...

How to enable or disable SSH for a specific user or user group in Linux

Due to your company standards, you may only allow...

How to install and deploy MySQL 8.0 under CentOS8

MySQL 8 official version 8.0.11 has been released...

Example of using js to natively implement year carousel selection effect

Preface Use js to achieve a year rotation selecti...

Docker image import and export code examples

Import and export of Docker images This article i...

How to write the parent and child directories of HTML relative paths

How to indicate the parent directory ../ represent...

Software Testing - MySQL (VI: Database Functions)

1.MySQL functions 1. Mathematical functions PI() ...

centos7.2 offline installation mysql5.7.18.tar.gz

Because of network isolation, MySQL cannot be ins...

Summary of methods to prevent users from submitting forms repeatedly

Duplicate form submission is the most common and ...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...