One: Download MySQL
Official website address: https://www.mysql.com/ Find the content of the following interface
2. Unzip the downloaded file and configure the ini file
The content of my.ini: as follows (the installation directory and storage directory are subject to your own.)
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\\MySQL\\mysql-8.0.20-winx64\\mysql-8.0.20-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\\MySQL\\mysql-8.0.20-winx64\\mysql-8.0.20-winx64\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
Three, initialize MySQL
Open the command prompt with administrator privileges , use the command to enter the MySQL bin path
//我安装的目录在D盘下,根据自己的安装目录写地址
cd /d D:\MySQL\mysql-8.0.20-winx64\mysql-8.0.20-winx64\bin
Then execute the following command:
mysqld --initialize --console
Show the interface to indicate that the command is executed successfully. At this time, there will be an initial password, which must be recorded, and the password should be twelve digits, root@localhost: the rest are passwords. Make a record to facilitate the modification of the password later.
Fourth, install MySQL
Install MySQL service and execute the following command
//(服务名可以不加默认为mysql,一般都使用默认)
mysqld --install [服务名]
The result of successful execution should display: Service successfully installed
After the service is installed, start MySQL by command
net start mysql //启动
net stop mysql //停止
Five, modify the default password
mysql -u root -p
Execute the command to modify the code:
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
After completing the above process, the configuration of MySQL is almost over, then we need to install a visualization tool to clearly know the data in our database.
Six, Navicat download
Link: https://pan.baidu.com/s/1Fy7QM_ckJNXGyf3jI8LD5g
Extraction code: 87bv
Download and unzip it to use.
Then confirm to connect successfully.