1. Download the installation package:
MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/
After the download is complete, unzip the downloaded zip file to your own software installation directory. (without spaces)
2. Installation steps:
Open the unzipped folder:
Create a new my.ini file to the MySQL folder directory
Modify the newly created my.ini configuration file as follows:
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录 ----------是你的文件路径-------------
basedir=D:\Software\mysql-8.0.32-winx64
# 设置mysql数据库的数据的存放目录 ---------是你的文件路径data文件夹自行创建
#datadir=E:\mysql\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
Initialize the MySQL database
Open the command prompt as an administrator ( must run as an administrator, otherwise an error will be reported later ), switch to the bin directory
Execute the command in the bin directory under the MySQL directory:
mysqld --initialize --console
The execution result is as shown in the figure below, and the initial password at the red box in the figure is recorded:
Install mysql service and start
mysqld --install mysql
The execution is successful, as shown in the figure below:
Start the MySQL service:
net start mysql
Execute the following command after startup:
mysql -uroot -p
Enter the random password just now:
change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY '111111';('111111'为要重新设定的密码)
The content shown in the following figure indicates that the execution is successful:
At this point, the installation and configuration of MySQL are all completed, open your third-party interface tool link to test, and the following figure will prompt success.
3. Records of problems encountered during installation:
1. Execute the installation database service statement and report an error:
mysqld --install mysql
solution:
Run cmd window as administrator.