Download MySQL
official website: https://dev.mysql.com/
https://dev.mysql.com/downloads/mysql/8.0.html
Select the corresponding system version
Click No thanks, just start my download to download
and decompress the compressed package and open the folder to create my.ini (right-click in the blank to create a text document, change the suffix name to ini, the system is hidden by default, In the computer menu bar, select View and check the file extension) because MySQL8.0 does not have a my.ini file
Copy the following files into the my.ini file
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录 ----------是你的文件路径-------------
basedir=D:\mysql-8.0.26\mysql
# 设置mysql数据库的数据的存放目录 ---------是你的文件路径data文件夹自行创建
datadir=D:\mysql-8.0.26\mysql\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4
Open command prompt as administrator
Switch to the bin directory
enter
mysqld --initialize --console
`Remember random password mine is: .zYKQ4#?.p#2
install mysql and start
mysqld --install mysql
Successful installation
Start MySQL and enter the following command
net start mysql
The startup is successful
. Log in to MySQL to change the password.
Enter the command to connect to MySQL.
mysql -uroot -p
change password command
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
The modification is successful.
Enter quit or exit to log out of MySQL .
MySQL environment variable configuration
This Computer->Properties->Advanced System Settings->Environment Variables
Or directly search for environment variables in the search box->Click Environment Variables
to create a new one in the system variables
Variable name: MYSQL_HOME
Variable value: your own MySQL installation directory
variable value is yours MySQL installation path
Then find the Path system variable -> Edit
and add the system variable just created above.
Here is to the bin directory
%MYSQL_HOME%\bin
After the creation is complete, make sure to save the variable,
so that MySQL is installed.
This step can be configured or not configured
Configure the MySQL startup service to manually make the computer boot faster
. Right-click this computer -> Manage
to see if MySQL is started