Mysql8.0.25 decompressed installation tutorial (Windows)

Posted by amitshah on Fri, 31 Dec 2021 00:26:55 +0100

1. Download from the official website

Address: https://dev.mysql.com/downloads/mysql/

Select 8.0 Version 25

2. Software decompression

2.1 selection of location

One thing to note: try to avoid Chinese in the decompression path, otherwise an error will be reported later.

3. Configuration file

3.1 create my INI file

Change the text suffix to ini and save it in ANSI format.

If it is not modified here, it may cause 4.2 Error 2 in 2, personal test!;

3.2 change my INI file content

Put my Ini use the coder on your computer to open and paste the code.

[mysqld]
# Set 3306 port
port=3306
# Set the mysql installation directory, which must be consistent with the installation path above
basedir=D:\\environment\\MySQL\\mysql-8.0.25
# Set the storage directory of mysql database data and generate it automatically without manual creation. Of course, it can also be placed in other places
datadir=D:\\environment\\MySQL\\mysql-8.0.25\\data
# Maximum connections allowed
max_connections=200
# Number of connection failures allowed.
max_connect_errors=10
# The character set used by the server is utf8mb4 by default
character-set-server=utf8mb4
# The default storage engine that will be used when creating new tables
default-storage-engine=INNODB
# The "mysql_native_password" plug-in authentication is used by default
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set of mysql client
default-character-set=utf8mb4
[client]
# Set the default port used by mysql client when connecting to the server. It is not recommended to modify. This is a recognized port number
port=3306
default-character-set=utf8mb4

3.3 modify sql directory of configuration file

Replace the MySQL decompression path of your computer with the following two paths: \ MySQL\mysql, but note that the \ data behind datadir cannot be modified, and here is "\" not \, which should be noted.

# Set the mysql installation directory, which must be consistent with the installation path above
basedir=D:\\environment\\MySQL\\mysql-8.0.25
# Set the storage directory of mysql database data and generate it automatically without manual creation. Of course, it can also be placed in other places
datadir=D:\\environment\\MySQL\\mysql-8.0.25\\data    //Can't forget data

4. Initialize the database

4.1 enter the bin directory under mysql and enter the cmd command.


4.2 execution code

mysqld --initialize

You may report an error here

4.2. 1 error 1


Or VCruntime140_1.dll missing
PS: I found this picture online. I didn't take a screenshot at that time.

Solution 1

If you make this mistake, then
Microsoft official website: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Select your own system bits to download.
Today's computers generally choose X64 for download.

After downloading and installing, the error will disappear after installation.

4.2. 2 error 2. However, it is possible to report the following error code after executing the code:

Solution 2

The solution is also simple:
Put my INI file is opened with Notepad, and then the file in the upper left corner is saved as. Where to code, select ANSI format.

After execution, the cursor will appear on the next line. And you will find a data folder in your mysql folder. You can continue to the next step.

5. Register windows service

If cmd is still in MySQL bin directory, enter the following code in the code line

 mysqld --install MySQL

Execution success flag

6. Start mysql service

Enter the code in cmd

net start  MySQL


Note that cmd should be run as an administrator

7. Log in to MySQL

7.1 find temporary password

Find the file sk-pc.err (the file name SK PC here is the computer name in my computer attribute) in the folder just generated automatically, and open it with the compiler

Find * * A temporary password is generated for root@localhost : * * the following string of numbers is the temporary password. This is my temporary password: WSmnJ:bqz12g

7.2 official login

Execute the following code under your MySQL bin path, that is, execute 4.1 first, and then execute the following code

mysql -u root -p  

Then the following will appear

Copy, paste and fill in the password just now

Login succeeded!!!

8. Change password

Code first

alter user'root'@'localhost' identified by 'New password'; 
alter user'root'@'localhost' identified with mysql_native_password by 'New password';

Note that mysql8 After 0, you can only use the above two commands to change the password. Using other command-line methods will report errors. Xiaobai needs to pay attention to the semicolon behind it and can't forget it.
Then execute the following code

FLUSH PRIVILEGES;Refresh permissions
exit//sign out

You can log in with the password you just changed.

Topics: MySQL Back-end