xtrabackup报错:Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327

2022/5/27 2:20:06

本文主要是介绍xtrabackup报错:Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

使用xtrabackup备份数据库的时候,提示以下错误:

# /usr/bin/xtrabackup --no-timestamp --user=abce --password='abce' --socket='/tmp/mysql.sock'   --target-dir='/abcebackup/mysql' --backup
xtrabackup: recognized server arguments: --server-id=158 --datadir=/data --open_files_limit=65535 --log_bin=binlog --innodb_buffer_pool_size=128MB --innodb_io_capacity=5000 --innodb_log_buffer_size=32M --innodb_log_file_size=1G --innodb_log_files_in_group=3 --innodb_open_files=65535 --innodb_file_per_table=1 --innodb_flush_method=O_DIRECT --innodb_flush_log_at_trx_commit=1 
xtrabackup: recognized client arguments: --port=3306 --socket=/tmp/mysql.sock --user=abce --password=* --socket=/tmp/mysql.sock --target-dir=/abcebackup/mysql --backup=1 
220526 13:54:58  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock' as 'abce'  (using password: YES).
Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327. 
220526 14:09:28 Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /tmp/mysql.sock
Using server version 5.7.37-log
/usr/bin/xtrabackup version 2.4.26 based on MySQL server 5.7.35 Linux (x86_64) (revision id: 19de43b)

  

有可能是因为没有安装最新版的perl-DBD-MYSQL,但是我的环境已经安装了:

# rpm -qa|grep perl-DBD-MySQL
perl-DBD-MySQL-4.023-6.el7.x86_64

  

继续查看

# perl -MDBD::mysql -e 'print $DBD::mysql::VERSION'
Can't load '/usr/lib64/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.18: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
 at -e line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.

  

查看mysql的/usr/local/mysql/lib/下的libmysqlclinet.so库文件

# ll /usr/local/mysql/lib/ | grep libmysqlclient
-rw-r--r-- 1 7161 31415  21915408 Nov 30 04:44 libmysqlclient.a
lrwxrwxrwx 1 7161 31415        20 Nov 30 04:53 libmysqlclient.so -> libmysqlclient.so.20
lrwxrwxrwx 1 7161 31415        25 Nov 30 04:53 libmysqlclient.so.20 -> libmysqlclient.so.20.3.24
-rwxr-xr-x 1 7161 31415   9518848 Nov 30 04:44 libmysqlclient.so.20.3.24

  

可以看到没有libmysqlclient.so.18

 

解决方法

# wget -O /usr/lib/libmysqlclient.so.18 http://files.directadmin.com/services/es_7.0_64/libmysqlclient.so.18 

  



这篇关于xtrabackup报错:Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1327的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程