1. Download the compressed package version
https://dev.mysql.com/downloads/mysql/
2. Decompress mysql-8.0.23-winx64 and place it in the root directory of Disk D
3. Configure the initial my.ini file
There is no my.ini file in the decompressed directory. Create my.ini in the installation root directory (new text file, change the file suffix to .ini), and write the configuration:
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\mysql-8.0.23-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\mysql-8.0.23-winx64\data # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB
The path in the configuration file should be consistent with the actual storage path (8.0.18 do not manually create the Data folder)
4. Initialize Mysql
1) Open the bin directory under mysql
2) Select all the red boxes above
3) Enter cmd and a command box will pop up
4) Enter mysqld --initialize --user=mysql --console in the command box
5) The red box below the above figure is the login password of Mysql generated by the system (copy to txt first)
If the above error message appears during the initialization process, please download the relevant Microsoft patch and install it.
5. Install Mysql and start Mysql
enter
mysqld --install
You will be prompted to install successfully
enternet start mysql
Start the Mysql service
6. Modify the initial password
enter
mysql -u root -p
Copy and paste the initial password generated by the system just now
enter
ALTER USER'root'@'localhost' IDENTIFIED BY'new password'; (change password)