content
1. Enter MySQL official website to download and install
2. Configure and initialize MySQL
3. Configure environment variables
4. Inspection and installation
1. Enter MySQL official website to download and install
Enter Mysql official website MySQL
Click on the DOWNLOADS drop-down page and click on the red box content
Click the red box after jumping to the page
After downloading and extracting to the destination folder (be sure to remember the path)
2. Configure and initialize MySQL
First create a txt document and copy the following code
The installation directory needs to be changed to the directory you downloaded
The storage directory needs to be changed to the newly created data folder directory
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:mysql-8.0.26-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:mysql-8.0.26-winx64data
# 允许最大连接数
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
Save the document as changing the format
Change the file name to my.ini
Change save type to All files
After saving effect
run cmd as administrator
After opening, first enter D: (remember to add a colon) from the C drive to other drives, you must first go to other drives before you can use the cd command
re-enter
cd D:mysql-8.0.26-winx64mysql-8.0.26-winx64in(bin文件的路径)
Enter in the bin directory under the MySQL directory
mysqld --initialize --console
After running, remember root@localhost: The password after that will be used later
Then start the MySQL service and change the password
Then enter mysqld --install
When the red line appears, the installation is successful.
re-enter
net start mysql
start MySQL
re-enter
mysql -uroot -p
At this point, enter the password you just saved and paste it on the command console
After entering the correct password, we enter
ALTER USER 'root'@'localhost' IDENTIFIED BY '你想改新的密码';
Go to the last step after the change
3. Configure environment variables
Open Control Panel find Advanced System Settings and open Environment Variables
After opening, click New
Fill in as shown
Then find the path in the system variables and click Edit, then click New to add the words
%MYSQL_HOME%in
%MYSQL_HOME%
This completes the installation and configuration, and then check whether the installation is successful
4. Inspection and installation
As in the above steps, open cmd and enter cd + space + your own bin file path, then enter mysql -h localhost -u root -p to log in to the database, and then enter the database password to view the information.
Enter the status command to view the version information of MySQL, indicating that the installation is successful
feel browsing