os: centos 7.4.1708
db: mysql 8.0.20
版本
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
#
#
# yum list installed |grep -i mysql80
mysql-community-client.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-common.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-devel.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-libs.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-libs-compat.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-server.x86_64 8.0.20-1.el7 @mysql80-community
mysql-community-test.x86_64 8.0.20-1.el7 @mysql80-community
mysql80-community-release.noarch el7-3 installed
# mysql -e "select version();"
+-----------+
| version() |
+-----------+
| 8.0.20 |
+-----------+
報錯信息
# xtrabackup --backup --datadir=/var/lib/mysql/ --target-dir=/backup/backupset/20200622_base
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql --innodb_flush_method=O_DIRECT --datadir=/var/lib/mysql/
xtrabackup: recognized client arguments: --host=localhost --user=root --password=* --backup=1 --target-dir=/backup/backupset/20200622_base
xtrabackup version 8.0.13 based on MySQL server 8.0.20 Linux (x86_64) (revision id: fdf0f4c)
200622 14:20:20 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=localhost' as 'root' (using password: YES).
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;host=localhost','root',...) failed: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory at - line 1535.
200622 14:20:20 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: not set
Using server version 8.0.20
主要還是 mysql 8.0 的用戶密碼插件 caching_sha2_password 引起的
In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password. For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin.
mysql> alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlmysql';