AutoMySQLBackup 3.0在MySQL 5.7中的问题修复[亲测有效]

AutoMySQLBackup 3.0在MySQL 5.7中的问题修复[亲测有效]最近一个电子看板小项目上线,由于数据库非常小,而且数据也不太重要。因此未选择XtraBackup备份,打算用AutoMySQLBackup来备份,结果部署后测试发现,有一些小问题是之前解决过的。有一些

AutoMySQLBackup 3.0在MySQL 5.7中的问题修复

 

最近一个电子看板小项目上线,由于数据库非常小,而且数据也不太重要。因此未选择XtraBackup备份,打算用AutoMySQLBackup来备份,结果部署后测试发现,有一些小问题是之前解决过的。有一些是MySQL 5.7版本才有的。下面记录一下解决过程。关于AutoMySQLBackup的基础知识,参考我这篇博客MySQL备份还原——AutoMySQLBackup介绍。这里不做详细介绍。这里的MySQL版本: 5.7.30

 

 

测试过程,备份日志出现下面告警信息:

 

###### WARNING ######

代码100分

代码100分Errors reported during AutoMySQLBackup execution.. Backup failed

Error log below..

代码100分mysql: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqlshow: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.

 

 

 

1:解决WARNING: –ssl is deprecated and will be removed in a future version. Use –ssl-mode instead.报错:

 

因为从MySQL 5.7.11开始,开始使用–ssl-mode参数,而抛弃/丢弃了参数–ssl,所以之前的MySQL版本不会遇到这个告警信息。关于这方面的知识,具体参考下面官方文档资料:

 

MySQL client programs now support an –ssl-mode option that enables you to specify the security state of the connection to the server. Permitted option values are PREFERRED (establish an encrypted connection if the server supports the capability, falling back to an unencrypted connection otherwise), DISABLED (establish an unencrypted connection), REQUIRED (establish an encrypted connection, or fail), VERFIFY_CA (like REQUIRED, but additionally verify the server certificate), VERIFY_IDENTITY (like VERIFY_CA, but additionally verify that the server certificate matches the host name to which the connection is attempted). For backward compatibility, the default is PREFERRED if –ssl-mode is not specified.

 

These clients support –ssl-mode: mysql, mysqladmin, mysqlbinlog, mysqlcheck, mysqldump, mysqlimport, mysqlshow, mysqlpump, mysqlslap, mysqltest, mysql_upgrade.

The –ssl-mode option comprises the capabilities of the client-side –ssl and –ssl-verify-server-cert options. Consequently, both of those options are now deprecated and will be removed in a future MySQL version. Use –ssl-mode=REQUIRED instead of –ssl=1 or –enable-ssl. Use –ssl-mode=DISABLED instead of –ssl=0, –skip-ssl, or –disable-ssl. Use –ssl-mode=VERIFY_IDENTITY instead of –ssl-verify-server-cert options. (The server-side –ssl option is not deprecated.)

 

For the C API, the new MYSQL_OPT_SSL_MODE option for mysql_options() corresponds to the –ssl-mode option. The MYSQL_OPT_SSL_ENFORCE and MYSQL_OPT_SSL_VERIFY_SERVER_CERT options for mysql_options() correspond to the client-side –ssl and –ssl-verify-server-cert options. They are now deprecated and will be removed in a future MySQL version. Use MYSQL_OPT_SSL_MODE with an option value of SSL_MODE_REQUIRED or SSL_MODE_VERIFY_IDENTITY instead.

 

For more information, see Command Options for Encrypted Connections, and mysql_options().

 

In consequence of this change, the minor C API version number was incremented

 

 

所以这里有两个解决方案,都非常简单:

 

 

1:在配置文件里面设置CONFIG_mysql_dump_usessl=”no”后即可解决。简单快捷,不用修改代码

 

# Use ssl encryption with mysqldump

CONFIG_mysql_dump_usessl=”no”

 

2:修改脚本automysqlbackup,具体操作,将脚本中的–ssl选项替换为–ssl-mode。治标治本。当然最正确的方法是根据MySQL版本选择参数。

 

clip_image001

 

2:解决上面问题后,报错的提示变为下面这个样子,之前这篇博客MySQL备份还原——AutoMySQLBackup介绍中介绍的方法不灵了。因为MySQL版本变化了。输出信息变化了。之前的方法自然失灵了。世界总是变化的,很难有一成不变的事物!

 

###### WARNING ######

Errors reported during AutoMySQLBackup execution.. Backup failed

Error log below..

mysql: [Warning] Using a password on the command line interface can be insecure.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

mysqlshow: [Warning] Using a password on the command line interface can be insecure.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

mysqldump: [Warning] Using a password on the command line interface can be insecure.

 

修改脚本automysqlbackup(这个脚本视Linux版本不同,位置有所不同,一般位于/usr/local/bin/automysqlbackup或/usr/bin/automysqlbackup下面),在removeIO后面加上这段代码解决这个问题:

 

# Remove annoying warning message since MySQL 5.7

if [[ -s "$log_errfile" ]]; then

      sedtmpfile="/tmp/$(basename $0).$$.tmp"

      grep -v "mysqldump: [Warning] Using a password on the command line interface can be insecure." "$log_errfile" | 

      grep -v "mysql: [Warning] Using a password on the command line interface can be insecure."  | 

      grep -v "mysqlshow: [Warning] Using a password on the command line interface can be insecure."  > $sedtmpfile

      mv $sedtmpfile $log_errfile

fi

 

clip_image002

 

 

如果你能驾驭工具,自然得心应手。随着平台环境、版本的变化,出现的各种问题都能被你解决。如果你只是被动的使用工具,那么遇到一点小问题,就会束手无策。工作这么多年,感觉DBA的硬技能中的一非常重要的能力:解决问题的能力。这个能力需要不断通过实战锻炼、培养、升级!

 

 

参考资料:

 

https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-11.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/7920.html

(0)
上一篇 2023-03-11
下一篇 2023-03-11

相关推荐

  • Zookeeper的Java API操作(一)

    Zookeeper的Java API操作(一)环境搭建 创建一个普通的Maven项目 导入log4j.properties日志文件到项目的根目录或者resource文件下。 在pom.xml中添加Zookeeper的相关依赖: <depen

    2023-04-20
    106
  • redis怎么做分页「建议收藏」

    redis怎么做分页「建议收藏」redis的SortedSet中的指令ZREVRANGE key start stop又可以返回指定区间内的成员,可以用来做分页;List中的LRANGE key start stop指令也能做到分…

    2022-12-20
    105
  • Python中os.path.join的路径拼接功能

    Python中os.path.join的路径拼接功能在Python编程中,路径拼接功能是一个非常重要的模块,它可以方便地将多个路径拼接在一起,生成一个有效的路径,os.path.join()方法正是为此而生,本文将详细阐述os.path.join()的用法。

    2023-12-26
    58
  • 并发控制的概念_并发控制概念

    并发控制的概念_并发控制概念11章 并发数据 了解并发需要先了解的概念: 1.数据库是一个可以共享资源,可以多用户同时使用一个数据库,该数据库称为多用户数据库,如订票系统、银行系统 2.多事务执行方式: 1.事务串行执行 : 务

    2023-06-18
    82
  • Python字符串首字母大写:优化您的输出

    Python字符串首字母大写:优化您的输出Python中的字符串是不可变的序列,这就意味着我们不能在字符串中直接修改单个字符。但是,有时需将字符串中的某些字符进行修改,比如变为首字母大写,这时我们可以使用字符串的一些方法来实现。字符串首字母大写即将字符串中每个单词的首字母都变为大写字母。

    2024-02-24
    60
  • mysql8.0版本递归查询「建议收藏」

    mysql8.0版本递归查询「建议收藏」 1.先在mysql数据库添加数据 DROP TABLE IF EXISTS `dept`;CREATE TABLE `dept` ( `id` int(11) NOT NULL, `pid`…

    2023-03-21
    107
  • centos安装Redis和设置远程访问[通俗易懂]

    centos安装Redis和设置远程访问[通俗易懂]记录下步骤以后用到时翻一翻。一、下载官方的文件包和编译在redis官网的下载页面,这里可以选择离线包或在线下载。我选择在线的,在下载页面往下拉到 Installation这里官方已经教你如何在线下载了

    2022-12-22
    98
  • MYSQL事务与并发控制实验_mysql数据库事务

    MYSQL事务与并发控制实验_mysql数据库事务很多程序员都学过MySQL,而且也会写SQL语句。但仅仅会写还远远不够,在面试中以及在工作中,还必须要会事务和并发。 一、事务 事务是满足 ACID 特性的操作,可以通过 Commit 提交事务,也可

    2023-02-23
    109

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注