One 、 download
Go to the official website to download ：https://dev.mysql.com/downloads/mysql/
The latest version is 8.0.23
MySql There are two ways to install ：1,.zip Unpack the package and configure it ;2,.msi Image interface installation . Here's the first way , So download .zip The compressed package is shown in the figure below ：
hold zip and msi It's all downloaded , It looks like this .
Two 、 Installation configuration
1、 First turn on the zip Unpack the package to the installation path . for example ：D:\Program Files\mysql
2、 add to mysql.ini The configuration file , The contents of the document are as follows
[mysql] # Set up mysql Client default character set default-character-set=utf8 [mysqld] # Set up 3306 port port = 3306 # Set up mysql Installation directory basedir=D:\Program Files\mysql # Set up mysql Database data storage directory datadir=D:\Program Files\mysql\data # Maximum connections allowed max_connections=200 # The character set used by the server defaults to 8 Bit coded latin1 Character set character-set-server=utf8 # The default storage engine that will be used when creating a new table default-storage-engine=INNODB
Be careful ： Among them basedir and datadir To change to the actual installation path .
3、 Configure environment variables
On my computer =》 Right click Properties =》 Advanced system setup =》 senior =》 environment variable =》 System variables =》path, Create a new record , The value is D:\Program Files\mysql\bin, as follows ：（ This is a windows10, If it's older windows operating system , add to path The value is slightly different , Add the value directly to the original path It's worth it ）
path After adding ：
4、 initialization mysql
Open as administrator cmd, Enter the installation path ,（ You don't have to go into the installation route , Because environment variables are configured , Individual be fond of ）
Execute initialization command ：
mysqld --initialize --console
Pictured , A temporary password will be generated here , Copy it out for backup .
5、 install mysql service
mysqld --install [ service name ]
6、 start-up mysql service
net start mysql
thus ,mysql The installation is complete , But because you need to change your password to log in for the first time , therefore ...
7、 Log in and change the password
mysql -u root -p
Temporary passwords come in handy
But you can't use it without changing the password , The password modification command is required
ALTER USER 'root'@'localhost' IDENTIFIED BY ' New password ';
Log out and log in again , It's ready to operate .
3、 ... and 、 Add
That's all mysql Download and install process for , But here it is , Yes mysql The operation of cmd It's not convenient to do it in the middle , You can install graphical interface tools such as Navicat、SQLyog、mysql-workbench etc. .
I'll improve it when I have time .