Mysql8 initialization settings


Reference environment: Ubuntu 20.04 + mysql8.0.23

apt install -y mysql-server mysql-client

1、 General operation
1. Initialize root password

sudo mysql_secure_installation

2. Login to MySQL:

#Login to MySQL:
mysql -u root -p

3. Let’s look at the encrypted password:

use mysql;
select host, user, authentication_string from user;

2、 Remote root access (not recommended):

1. After logging in to MySQL, modify the root host

update user set host='%' where user='root';
flush privileges;

2. Modify my.cnf

#Note lines 31 and 32:
#bind-address        =
#mysqlx-bind-address    =

3. Exit MySQL and restart the MySQL service


service mysql restart

If Navicat is used to connect mysql 8.0, an error is reported

2059 - authentication plugin 'caching_sha2_password' 

terms of settlement:

#Login to MySQL
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_ native_ Password by 'password';

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]