Install MySQL8 on Windows 10
1 Download the installation package from the official website
Download address: https://dev.mysql.com/downloads/mysql/
2 Decompressing Configuration
2.1 unzip
After decompression, the picture is as follows:
2.2 Initializing the Configuration File
Create configuration file my.ini using Notepad:
[mysqld]
Set port 3306
port=3306
Set mysql installation directoryBasedir = D: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64Mysql > select * from 'mysql'Datadir = D: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64 \ data# Maximum number of connections allowed
max_connections=200
The number of connection failures allowed.
max_connect_errors=10
The default character set used by the server is UTF8MB4
character-set-server=utf8mb4
The default storage engine to use when creating new tables
default-storage-engine=INNODB
The mysql_native_password plugin is used by default
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
Mysql client default character set
default-character-set=utf8mb4
[client]
Set the default port used by mysql client to connect to server
port=3306
default-character-set=utf8mb4
Copy the code
The path in the configuration file must be the same as the actual path. The data directory data is automatically created during initialization.
3 Initialize MySQL
Open the CMD console as an administrator, switch to /bin, and run the following command:
C:\Windows\system32>d:
D:\>cdD: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64 \ bin D: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64 \ bin > mysqld -- the initialize --consoleCopy the code
Note to save the password shown above:
A temporary password is generated for root@localhost: tRPLIpky:8yr
–> tRPLIpky:8yr
4 Install and start the MySQL database
MySQL > install MySQL
D: Application\MySQL8\mysql-8.0.25-winx64\bin>mysqld --install### (mysql)
Copy the code
If the situation as shown in the screenshot above shows that the installation is successful!
Start MySQL service:
D: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64 \ bin > net start mysqlCopy the code
Check the listening port:
D: \ Application \ MySQL8 \ mysql - 8.0.25 - winx64 \ bin > netstat ano | findstr searches"3306"
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 55656
TCP 0.0.0.0:33060 0.0.0.0:0 LISTENING 55656
TCP [::]:3306 [::]:0 LISTENING 55656
TCP [::]:33060 [::]:0 LISTENING 55656
TCP [::1]:3306 [::1]:51309 TIME_WAIT 0
TCP [::1]:3306 [::1]:51334 TIME_WAIT 0
TCP [::1]:3306 [::1]:51338 TIME_WAIT 0
Copy the code
5 Summarize the installation process
- Initialized MySQL
- Create a service
- Start the service
6 Enable the Windows Firewall
Select \bin\mysqld.exe to decompress MySQL.
7 Use Navicat to connect to the database
7.1 Configuring Connection Information
7.2 Testing the Connection
7.3 Changing the Initial Password
7.4 Login Succeeded
8 Authorize remote connection
Mysql > connect to mysql. mysql > connect to mysql. mysql > connect to mysql. mysql > connect to mysql. mysql
D: Application\MySQL8\mysql-8.0.25-winx64\bin>mysql -uroot -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type'help; ' or '\h' for help. Type '\c' to clear the current input statement.
Copy the code
Mysql8 separates user creation and authorization, no longer allowing the same command to create user and authorization:
mysql> CREATE USER 'root'@'192.168.4.136' IDENTIFIED BY 'a-111111';
Query OK, 0 rows affected (0.05 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.4.136'WITH GRANT OPTION; Query OK, 0 rows affected (0.06 SEC) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01sec)Copy the code
Remote connection via Navicat: