mysqldump指定数据表导出

作者:matrix 被围观: 3,228 次 发布时间:2021-03-31 分类:mysql | 2 条评论 »

这是一个创建于 1083 天前的主题,其中的信息可能已经有所发展或是发生改变。

平时习惯使用mysql客户端工具直接导出表数据,这突然需要导出指定前缀的表反而变得麻烦,因为表非常多但又不想全部选择。

e.g. 导出dict_开头的数据表

查询符合条件的表名

select table_name from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'heal' and table_name like 'dict_%';

执行导出命令

mysqldump --column-statistics=0 -h 127.0.0.1 -P3306 -pPASSWORD  -t heal -uroot --tables dict_union dict_tag > ~/db_script.sql

-P端口号
-p密码
--tables 指定多个数据表

报错 mysqldump: Couldn't execute

mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')                FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'heal' AND TABLE_NAME = 'dict_union';': Unknown table 'COLUMN_STATISTICS' in information_schema

需要添加参数--column-statistics=0

参考:

https://www.cnblogs.com/commissar-Xia/p/10302336.html

https://researchlab.github.io/2017/02/22/mysql-import-export-summary/

其他文章:
本文固定链接:https://www.hhtjim.com/the-mysqldump-designated-export-data-tables.html
matrix
本文章由 matrix 于2021年03月31日发布在mysql分类下,目前没有通告,你可以至底部留下评论。
转载请注明:mysqldump指定数据表导出-HHTjim'S 部落格
关键字:,

有2 条评论 »

  1. 谷歌优化 谷歌优化 2022-10-13 8:42:12 +0800#2

    这个看的不是很懂 😂

  2. Mixspace Mixspace 2021-6-1 10:11:44 +0800#1

    感觉自己看了点代码的东西也是白看了

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!