Install mysql-8.0.23-winx64

1. Download

Official download address
https://dev.mysql.com/downloads/mysql/

Insert picture description here
Insert picture description here

2. Unzip

Directory structure after decompression:
Insert picture description here

3. Configure the my.ini file

  1. Create a my.ini file in the unzipped file directory

Insert picture description here

  1. Paste the following code into the my.ini file
[mysqld]
port=3306
basedir=C:\Program Files\mysql-8.0.23-winx64
datadir=C:\Program Files\mysql-8.0.23-winx64\Data
max_connections=200
max_connect_errors=10
character-set-server=utf8mb4
default-storage-engine=INNODB
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
default-character-set=utf8mb4
[client]
port=3306
default-character-set=utf8mb4
  1. Modify path
  1. Change the path of basedir to 解压后文件的路径
  2. Change the path of datadir to 解压后文件的路径\Data

4. TakeAdministrator statusOpen cmd

  1. Use the dos command to enter the bin folder under the decompressed file

5. Initialize the database

Execute the following command in the bin folder

	mysqld --initialize --console

Some computers encountered here: Cannot continue to execute code because vcruntime140_1.dll cannot be found
Insert picture description here

The problem that is not mysql is that the computer lacks a dynamic link library (.ddl file)

Download the vcruntime140_1.dll file at the link below and put it in the C:\Windows\System32directory to solve it
https://cn.dll-files.com/vcruntime140_1.dll.html

Then re-execute

	mysqld --initialize --console

Insert picture description here
Remember this temporary password

6. Installation Service

	mysqld --install

Insert picture description here

7. Start the service (execute the following command in the bin folder)

	net start MySql

Insert picture description here

8. Log in to the database (execute the following command in the bin folder)

	mysql -u root -p

9. Change Password

Execute the following command in MySQL (modify the password verification plug-in, and modify the password at the same time.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';

The installation has been completed so far! ! !

10. Configure environment variables

1. Why configure environment variables? ? ?

If you do not configure environment variables, you must enter the bin directory of MySQL every time you log in to the MySQL server, that is cd C:\Program FilesC:\Program Files\mysql-8.0.23-winx64\bin, you can use other command tools such as MySQL after you enter a command, which is more troublesome. After configuring the environment variables, you can execute MySQL commands anywhere.

2. Configuration

Search environment variables
Insert picture description here

Find the path and edit it

Insert picture description here
Add a line to the bin directory under the decompressed file.
Insert picture description here
After adding it, you can always confirm

Then close cmd, reopen it as an administrator, execute the following statement in any directory to close the service, and the configuration is successful.

	net stop mysql

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45773503/article/details/115257452