mysql 8.0 zip installation method mysql-8.0.22-winx64.zip

Original address: https://blog.csdn.net/csd_nuser/article/details/110109844

The goal of this blog is to integrate most commonly used software installation and usage instructions, and technical solutions release. Please continue to pay attention.

The download version is: mysql8.0.22

1. Download address: https://dev.mysql.com/downloads/mysql/

Please download the zip version. Please refer to Figure 2 to download other versions

Figure 2​​
figure 1
image 3

 This is the case after downloading and decompressing, you will find that there is no my.ini file

 2. Create a new my.ini file, please modify the path according to the actual situation

[mysqld]
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:/mysql-8.0.22-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:/mysql-8.0.22-winx64/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8

3. As an administrator, cd to the current directory, D:/mysql-8.0.22-winx64/bin

Execute the command, you must add --consol here, the initial password of root will be printed out

mysqld --initialize --console

This process takes about 10 seconds, and the mysql database will be initialized automatically.

Then execute the following commands as needed

Execute the command: mysqld -install #install mysql (the installation is successful, prompt Service successfully installed.)

Execute the command: mysqld -remove #delete        service

Execute the command: net start mysql #Start the service

Execute the command: net stop mysql #stop the service

After that, execute mysql -u root -p in the bin directory to enter without password

首先会提示:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

You need to change the password first, because the password just now is random

alter user user() identified by 'root';

Then you can execute it at will

First need to solve the authorization problem

By default, it will prompt when grant all on *.* to'root'@'%' is executed

ERROR 1410 (42000): You are not allowed to create a user with GRANT

Reason: There is no root-% record in the current user table; you can update root-localhost to root-%

Need to be executed, pay attention to the following conditions, because mysql regards host+user as the combined primary key.

update user set host = '%' where user = 'root' and host='localhost';

 

Here also need to create a remote login user, note that mysql8.0 can no longer be used

GRANT ALL PRIVILEGES ON *.* TO'root'@'%' WITH GRANT OPTION; (available before mysql8.0)

Ways to create users and authorize them.

mysql8.0 method to create users and authorization

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Refresh the database

flush privileges;

 

PS: At this point, many people found that the old version of the connection tool (navcat) could not be connected, and then a bunch of articles on the Internet talked about how to change the password. In fact, it is not recommended to change, or just upgrade navcat. Or just use 5.7. But here is still a note about the modification method. It is really not recommended.

(Here is still to record the way to modify the password rules

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

FLUSH PRIVILEGES; #Refresh

)

 

 

Some other commonly used commands

show variables like'character%'; # Display encoding set
set character_set_client=utf8; # Configure encoding
set character_set_connection=utf8;
set character_set_database=utf8;
set character_set_database=utf8;
set character_set_results=utf8;
set character_set_server=utf8;
set character_set_system=utf8;
show variables like'character%'; # View configuration results

 

PS:

If you are prompted for missing files during the execution of mysqld init, please refer to the link below

https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads

Download the corresponding version on demand

If there is any problem during the installation process, please reply in the comment area, we will continue to update

 

 

 

Guess you like

Origin blog.csdn.net/csd_nuser/article/details/110109844
Recommended