Mysql8 initialization settings

Time:2021-7-25

Reference environment: Ubuntu 20.04 + mysql8.0.23
Installation:

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:

#mysql>
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

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

2. Modify my.cnf

/etc/mysql/mysql.conf.d/mysqld.cnf
#Note lines 31 and 32:
#bind-address        = 127.0.0.1
#mysqlx-bind-address    = 127.0.0.1

3. Exit MySQL and restart the MySQL service

#mysql>
exit;

#
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
#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 […]