download

  • Find a mysql8.0 installation package to download online, there are installation packages and zip packages, I used to zip packages

    Dev.mysql.com/downloads/m…

The installation

  • Unzip it to your favorite disk. I usually put it on drive C
  • Environment variables need to be configured. Add mysql bin directory in PATH
  • You need to create a new data folder and a my.ini file in the mysql root directory
[mysqld]

Set port 3306

port=3306

Set mysql installation directory

basedir=C:\Program Files\mysql-8.0.22-winx64

Mysql > select * from 'mysql'

datadir=C:\Program Files\mysql-8.0.22-winx64\data

# Maximum number of connections allowed

max_connections=200

The number of connection failures allowed. This is to prevent someone from the host from trying to attack the database system

max_connect_errors=10

The default character set used by the server is UTF8

character-set-server=utf8

The default storage engine to use when creating new tables

default-storage-engine=INNODB

[mysql]

Mysql client default character set

default-character-set=utf8

[client]

Set the default port used by mysql client to connect to server

port=3306

default-character-set=utf8
Copy the code
  • Run the following command to open the bin directory of mysql
Install the mysql server
mysqld --install mysql
Initialize mysql
mysqld --initialize --console
# start mysql service
net start mysql
Copy the code
  • After mysql is initialized, the password is displayed. Log in to mysql and run the following command to change the password
Add user and password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
# authorization
GRANT ALL PRIVILEGES ON*. *TO 'root'@The '%';
GRANT ALL ON*. *TO 'root'@The '%';
# refresh permission
flush privileges;
Copy the code

Then you can use mysql happily, of course, there may be various problems, at this time you need to use Baidu method