Download and install mysql5.7 on windows10

1. Download

Official website address: (Community Edition) https://downloads.mysql.com/archives/community/

All published versions of the article can be selected
In the download interface, select the 64-bit zip. This is the green version and the msi image installation board. Don’t make a mistake.
Download and unzip

2. Unzip and install

It is found that there is no data directory and my.ini file in the mysql root directory. It doesn't matter. The system will automatically create a data directory when initializing mysql. We only need to create a my.ini file.
Create a new text document and save it as a my.ini file. The contents are:

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=F:\mysql-5.7.24-winx64
# 设置mysql数据库的数据的存放目录
datadir=F:\mysql-5.7.24-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

The installation directory and storage directory are set according to your own needs.

Search cmd to find the command prompt, right-click and run as administrator, enter the bin directory of the installation directory, and enter the following command:

mysqld --initialize --user=mysql --console

In the printed log, there will be an initial password, record it and use it to log in. In this way, the installation and the generation of the data folder and related files are completed.
Insert image description here

Enter the following command to install mysql:

mysqld --install mysql

Display Service successfully installed. Indicates successful installation.
Insert image description here

3. Log in

Enter the following command to start mysql:

net start mysql

Insert image description here

Enter the following command to log in to mysql: mysql -u root -p. The initial password is mysqld --initialize --user=mysql --consolethe log we printed during execution.

Insert image description here

4. Change the initial password

Modify the mysql login password and enter the following command (note the semicolon)

set password=password('新密码');

Insert image description here

After modification, remember to update and enter:

flush privileges;

Insert image description here

5. Configure environment variables

In order to facilitate subsequent operations, we need to configure the environment variables of mysql. Select Path and add our bin directory to the environment variables.
Insert image description here

Then add in path:

;%MySql%\bin

Insert image description here

This article refers to: Download and installation of mysql5.7 version on windows10

Guess you like

Origin blog.csdn.net/weixin_43818488/article/details/125910294