当前位置:网站首页>MySQL 8.0.27 installation and configuration tutorial under Windows

MySQL 8.0.27 installation and configuration tutorial under Windows

2022-06-09 19:15:00 1024 Q

This article is an example for you to share mysql 8.0.27 Specific code for installing and configuring graphic tutorial , For your reference , The details are as follows

download

Download the installation package on the official website :>MySQL :: Download MySQL Community Server

install

1、 Unzip the unzip file to your installation directory :D:\Program Files\MySQL

Be careful : Don't put it in a directory with Chinese names and spaces

2、 stay mysql-8.0.11-winx64 Create a new my.ini Documents and a data Folder

#my.ini Add the following :[mysqld]# Set up 3306 port port=3306# Set up mysql Installation directory basedir=D:/Program Files/MySQL/mysql-8.0.27-winx64# Set up mysql Database data storage directory datadir=D:/Program Files/MySQL/mysql-8.0.27-winx64/data# Maximum connections allowed max_connections=200# Number of connection failures allowed . This is to prevent someone from trying to attack the database system from the host max_connect_errors=10# The character set used by the server defaults to UTF8character-set-server=utf8# The default storage engine that will be used when creating a new table default-storage-engine=INNODB[mysql]# Set up mysql Client default character set default-character-set=utf8[client]# Set up mysql The default port when the client connects to the server port=3306default-character-set=utf8

3、 Configure system environment

My computer → attribute → senior → environment variable → System variables → newly build

Variable name :MYSQL_HOME

A variable's value :D:\mysql-8.0.27-winx64  ( That's where I just unzipped it )

Path Create a new section :%MYSQL_HOME%\bin

4、 As Administrator ( Be sure to be an administrator ) open cmd Window jump path to

D:\Program Files\MySQL\mysql-8.0.27-winx64\bin

(1) initialization

mysqld --initialize --user=mysql --console

Correct result : Record randomly generated passwords , You need to use... When entering the database later .

Existing problems :

Solution :

The reason is because data The directory already exists , Delete data The directory can execute the initialization command again .

(2) Add service

mysqld -install

Existing problems :

Problems arise The service already exists , This is because it has been installed before mysql Clean and not deleted , Run as administrator again , Input sc query mysql, Take a look at the name mysql Service for , If it has been installed before , The following is displayed

Solution : command sc delete mysql, Delete the mysql, Then re install it .

Existing problems : When licensed , Error message Install/Remove of the Service Denied

Solution : open cmd.exe Program time selection “ Open as administrator ”.

(3) Start the service

net start mysql

(4) Log in to the database

mysql -u root -p

(5) Change Password

ALTER USER [email protected] IDENTIFIED BY '123456'; # Change the password to :123456

Two 、 Connect Navicat for MySQL

Connection name : Take at will ; The password is the password just set .

Existing problems : Report errors 1251

Solution : yes mysql8 In previous versions, the encryption rule was mysql_native_password, And in the mysql8 after , The encryption rule is caching_sha2_password, There are two ways to solve the problem , One is upgrading navicat drive , One is the mysql The encryption rule of user login password is restored to mysql_native_password. 

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; # Modify encryption rules  ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER; # Update the user's password  FLUSH PRIVILEGES; # Refresh the permissions  


原网站

版权声明
本文为[1024 Q]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091903078820.html