Mysql 版本:/usr/local/mysql/bin/mysql Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL)

报错:mysqldump全库备份后,导入时报错

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WARNING: --master-data is deprecated and will be removed in a future version. Us' at line 1

操作过程:

mysqldump全库备份,操作命令如下:

mysqldump -uroot -p****** --single-transaction --master-data=2 --routines --flush-logs --flush-privileges --all-databases --set-gtid-purged=OFF > fulldb_20220223.sql

后续导入新库报错:

mysql -uroot -p < fulldb_20220223.sql

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WARNING: --master-data is deprecated and will be removed in a future version. Us' at line 1

查看导出的文件头部:

# head -10 fulldb_20220223.sql 
WARNING: --master-data is deprecated and will be removed in a future version. Use --source-data instead.
-- MySQL dump 10.13  Distrib 8.0.26, for Linux (x86_64)
--
-- Host: localhost    Database: 
-- ------------------------------------------------------
-- Server version       8.0.26

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

导出的sql文件里多了一行Waring,提示master-data将废弃,建议使用source-data。

原因分析:

该情况属于Bug。Mysqldump 8.0.26新版本引入新参数,有waring提示正常,但错误信息本不该直接写到sql文件里的。MySQL Bugs: #104769: CLI options deprecation warnings of mysqldump are printed to stdout

解决方法:

方法一:

导出时就不使用master-data,改为source-data替代。这属于新版本8.0.26 mysqldump 的改变,新引入的参数。

方法二:

原本已经导出好文件,没必要浪费时间重新导出,直接注释掉或者删掉这一行Waring即可。

删除文件里第一行(Linux环境):

sed -i '1d' fulldb_20220223.sql

参考文档

A message "WARNING: --master-data is deprecated ..." is logged in the redirected file by mysqldump (Doc ID 2807795.1)    To BottomTo Bottom    
MySQL Bugs: #104769: CLI options deprecation warnings of mysqldump are printed to stdout

MySQL :: MySQL 8.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program

WARNING: --master-data is deprecated and will be removed in a future version相关推荐

  1. Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version.

    2019独角兽企业重金招聘Python工程师标准>>> PHP 接口,使用 ajax post方式提交数据的时候报错: Automatically populating $HTTP_ ...

  2. DeprecationWarning:current URL string parser is deprecated, and will be removed in a future version.

    DeprecationWarning:current URL string parser is deprecated, and will be removed in a future version. ...

  3. 【k8s】kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl

    登录一个已有的pod,执行ping 本文是之前文章的姐妹篇 kk exec -it nginx-deploy-5878ddd45b-nzsdv – sh 命令换了 kubectl exec [POD] ...

  4. 【解决两个警告】Model.fit_generator` is deprecated and will be removed in a future version. Please use `Mode

    在训练 经典卷积神经网络VGG时,因为版本问题,报了警告,下面来解决警告. 其实警告,大多来自前后版本的问题,可能你使用的这个版本里面对于一个方法是这个要求,下一个版本或者更新的版本,对于这个方法就是 ...

  5. FutureWarning: pandas.Int64Index is deprecated and will be removed ... in a future version. 解决方法

    调用 XGBoost 时遇到如下 FutureWarning: compat.py:36: FutureWarning: pandas.Int64Index is deprecated and wil ...

  6. using a dict on a Series for aggregation is deprecated and will be removed in a future version

    python的pandas中,在统计聚合的时候,版本问题,提示不支持字典格式了. 比如,下面代码这样改就可以了. words_stat = words_df.groupby(by=['segment' ...

  7. PHP 5.6 中 Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future

    在使用数组转换为XML 时,出现这种错误 Automatically populating $HTTPRAWPOSTDATA is deprecated and will be removed in ...

  8. Pycharm报错:FutureWarning: `distplot` is a deprecated function and will be removed in a future version

    最近在使用利用seaborn包中的distplot来查看数据集的分布图时遇到如下报错 引入包: import seaborn as sns from matplotlib import pyplot ...

  9. 【MySQL】警告: 1681 - XXX is deprecated and will be removed in a future release.

    (一)MySQL version MySQL Server 8.0.29 MySQL Workbench 8.0.29 (二)语句及问题 1. 语句: #5月17日学习#创建大气质量表 use tes ...

最新文章

  1. 大数据分析工资单:六大行员工再涨薪 人均年薪超26万
  2. Tomcat服务器环境配置--查看bat文件(解决Neither the JAVA_HOME nor the JRE_HOME environment variable is defined问题)
  3. mysql hypot_mysqli_stmt_prepare
  4. python实现气象数据分析统计服_Python数据分析实战:降雨量统计分析报告分析
  5. 关于Icon,Image,ImageIcon的简单的对比参考 上篇
  6. html 5新增技术,HTML5新增标签
  7. OC----预处理器
  8. python强转字符串_在Python 3中将Exception转换为字符串
  9. 调出远程桌面的任务管理器
  10. C++ STL常用算法总结
  11. Hibernate-02-核心配置文件Hibernate.cfg.xml
  12. 算法探究:线性时间选择问题
  13. VS2015 程序运行时系统找不到指定文件
  14. 燕十八-PHP公益培训-学习
  15. 趋势里的“生意经”,抖音电商服饰行业如何引爆春夏新品?
  16. gateway官网文档解读(六) 汇总
  17. 机器人程序设计入门(C++/Arduino/ROS)(转载2020版)
  18. 2016寒假读书笔记
  19. R与Excel之数据分析
  20. 解决Python的your data either using array.reshape(-1, 1) if your data has a single featur

热门文章

  1. 领导说要搞微服务,我该怎么搭建开发和测试环境?
  2. 使用 Scrapy 框架对重复的 url 无法获取数据,dont_filter=True
  3. 《Charles配置教程之Mac》
  4. 【CloudShell】阿里云壳EDR卸载指南
  5. VLAN规划原则与建议
  6. Nuxt.js 如何做SEO
  7. 百度搜索结果页面的参数 搜索框提示词搜索方式(rsv_sug2)
  8. WIFI营销读书笔记之二:跑马圈地
  9. 生产环境服务端报错:阿里云IOT连接中断
  10. AtCoder Beginner Contest 171 D - Replacing