Mysqldump的应用

--print-defaults        Print the program argument list and exit.

--no-defaults           Don't read default options from any option file.

--defaults-file=#       Only read default options from the given file #.

--defaults-extra-file=# Read this file after the global files are read.

  --all               Deprecated. Use --create-options instead.

  -A, --all-databases Dump all the databases. This will be same as --databases

                      with all databases selected.

  -Y, --all-tablespaces 

                      Dump all the tablespaces.

  -y, --no-tablespaces 

                      Do not dump any tablespace information.

  --add-drop-database Add a DROP DATABASE before each create.

  --add-drop-table    Add a DROP TABLE before each create.

  --add-locks         Add locks around INSERT statements.

  --allow-keywords    Allow creation of column names that are keywords.

  --character-sets-dir=name 

                      Directory for character set files.

  -i, --comments      Write additional information.

  --compatible=name   Change the dump to be compatible with a given mode. By

                      default tables are dumped in a format optimized for

                      MySQL. Legal modes are: ansi, mysql323, mysql40,

                      postgresql, oracle, mssql, db2, maxdb, no_key_options,

                      no_table_options, no_field_options. One can use several

                      modes separated by commas. Note: Requires MySQL server

                      version 4.1.0 or higher. This option is ignored with

                      earlier server versions.

  --compact           Give less verbose output (useful for debugging). Disables

                      structure comments and header/footer constructs.  Enables

                      options --skip-add-drop-table --skip-add-locks

                      --skip-comments --skip-disable-keys --skip-set-charset.

  -c, --complete-insert 

                      Use complete insert statements.

  -C, --compress      Use compression in server/client protocol.

  -a, --create-options 

                      Include all MySQL specific create options.

  -B, --databases     Dump several databases. Note the difference in usage; in

                      this case no tables are given. All name arguments are

                      regarded as database names. 'USE db_name;' will be

                      included in the output.

  -#, --debug[=#]     This is a non-debug version. Catch this and exit.

  --debug-check       Check memory and open file usage at exit.

  --debug-info        Print some debug info at exit.

  --default-character-set=name 

                      Set the default character set.

  --delayed-insert    Insert rows with INSERT DELAYED.

  --delete-master-logs 

                      Delete logs on master after backup. This automatically

                      enables --master-data.

  -K, --disable-keys  '/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and

                      '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put

                      in the output.

  -E, --events        Dump events.

  -e, --extended-insert 

                      Use multiple-row INSERT syntax that include several

                      VALUES lists.

  --fields-terminated-by=name 

                      Fields in the output file are terminated by the given

                      string.

  --fields-enclosed-by=name 

                      Fields in the output file are enclosed by the given

                      character.

  --fields-optionally-enclosed-by=name 

                      Fields in the output file are optionally enclosed by the

                      given character.

  --fields-escaped-by=name 

                      Fields in the output file are escaped by the given

                      character.

  --first-slave       Deprecated, renamed to --lock-all-tables.

  -F, --flush-logs    Flush logs file in server before starting dump. Note that

                      if you dump many databases at once (using the option

                      --databases= or --all-databases), the logs will be

                      flushed for each database dumped. The exception is when

                      using --lock-all-tables or --master-data: in this case

                      the logs will be flushed only once, corresponding to the

                      moment all tables are locked. So if you want your dump

                      and the log flush to happen at the same exact moment you

                      should use --lock-all-tables or --master-data with

                      --flush-logs.

  --flush-privileges  Emit a FLUSH PRIVILEGES statement after dumping the mysql

                      database.  This option should be used any time the dump

                      contains the mysql database and any other database that

                      depends on the data in the mysql database for proper

                      restore. 

  -f, --force         Continue even if we get an SQL error.

  -?, --help          Display this help message and exit.

  --hex-blob          Dump binary strings (BINARY, VARBINARY, BLOB) in

                      hexadecimal format.

  -h, --host=name     Connect to host.

  --ignore-table=name Do not dump the specified table. To specify more than one

                      table to ignore, use the directive multiple times, once

                      for each table.  Each table must be specified with both

                      database and table names, e.g.,

                      --ignore-table=database.table.

  --insert-ignore     Insert rows with INSERT IGNORE.

  --lines-terminated-by=name 

                      Lines in the output file are terminated by the given

                      string.

  -x, --lock-all-tables 

                      Locks all tables across all databases. This is achieved

                      by taking a global read lock for the duration of the

                      whole dump. Automatically turns --single-transaction and

                      --lock-tables off.

  -l, --lock-tables   Lock all tables for read.

  --log-error=name    Append warnings and errors to given file.

  --master-data[=#]   This causes the binary log position and filename to be

                      appended to the output. If equal to 1, will print it as a

                      CHANGE MASTER command; if equal to 2, that command will

                      be prefixed with a comment symbol. This option will turn

                      --lock-all-tables on, unless --single-transaction is

                      specified too (in which case a global read lock is only

                      taken a short time at the beginning of the dump; don't

                      forget to read about --single-transaction below). In all

                      cases, any action on logs will happen at the exact moment

                      of the dump. Option automatically turns --lock-tables

                      off.

  --max_allowed_packet=# 

                      The maximum packet length to send to or receive from

                      server.

  --net_buffer_length=# 

                      The buffer size for TCP/IP and socket communication.

  --no-autocommit     Wrap tables with autocommit/commit statements.

  -n, --no-create-db  Suppress the CREATE DATABASE ... IF EXISTS statement that

                      normally is output for each dumped database if

                      --all-databases or --databases is given.

  -t, --no-create-info 

                      Don't write table creation info.

  -d, --no-data       No row information.

  -N, --no-set-names  Suppress the SET NAMES statement

  --opt               Same as --add-drop-table, --add-locks, --create-options,

                      --quick, --extended-insert, --lock-tables, --set-charset,

                      and --disable-keys. Enabled by default, disable with

                      --skip-opt.

  --order-by-primary  Sorts each table's rows by primary key, or first unique

                      key, if such a key exists.  Useful when dumping a MyISAM

                      table to be loaded into an InnoDB table, but will make

                      the dump itself take considerably longer.

  -p, --password[=name] 

                      Password to use when connecting to server. If password is

                      not given it's solicited on the tty.

  -P, --port=#        Port number to use for connection.

  --protocol=name     The protocol to use for connection (tcp, socket, pipe,

                      memory).

  -q, --quick         Don't buffer query, dump directly to stdout.

  -Q, --quote-names   Quote table and column names with backticks (`).

  --replace           Use REPLACE INTO instead of INSERT INTO.

  -r, --result-file=name 

                      Direct output to a given file. This option should be used

                      in MSDOS, because it prevents new line '\n' from being

                      converted to '\r\n' (carriage return + line feed).

  -R, --routines      Dump stored routines (functions and procedures).

  --set-charset       Add 'SET NAMES default_character_set' to the output.

                      Enabled by default; suppress with --skip-set-charset.

  -O, --set-variable=name 

                      Change the value of a variable. Please note that this

                      option is deprecated; you can set variables directly with

                      --variable-name=value.

  --single-transaction 

                      Creates a consistent snapshot by dumping all tables in a

                      single transaction. Works ONLY for tables stored in

                      storage engines which support multiversioning (currently

                      only InnoDB does); the dump is NOT guaranteed to be

                      consistent for other storage engines. While a

                      --single-transaction dump is in process, to ensure a

                      valid dump file (correct table contents and binary log

                      position), no other connection should use the following

                      statements: ALTER TABLE, DROP TABLE, RENAME TABLE,

                      TRUNCATE TABLE, as consistent snapshot is not isolated

                      from them. Option automatically turns off --lock-tables.

  --dump-date         Put a dump date to the end of the output.

  --skip-opt          Disable --opt. Disables --add-drop-table, --add-locks,

                      --create-options, --quick, --extended-insert,

                      --lock-tables, --set-charset, and --disable-keys.

  -S, --socket=name   The socket file to use for connection.

  -T, --tab=name      Create tab-separated textfile for each table to given

                      path. (Create .sql and .txt files.) NOTE: This only works

                      if mysqldump is run on the same machine as the mysqld

                      server.

  --tables            Overrides option --databases (-B).

  --triggers          Dump triggers for each dumped table.

  --tz-utc            SET TIME_ZONE='+00:00' at top of dump to allow dumping of

                      TIMESTAMP data when a server has data in different time

                      zones or data is being moved between servers with

                      different time zones.

  -u, --user=name     User for login if not current user.

  -v, --verbose       Print info about the various stages.

  -V, --version       Output version information and exit.

  -w, --where=name    Dump only selected records. Quotes are mandatory.

  -X, --xml           Dump a database as well formed XML.

 

 

1. mysqldump -uroot -R -p dbname > out.sql 导出数据和过程

 2. mysqldump -uroot -R -d -t -p dbname > out.sql 只导出过程

 

mysqldump 详解:基础与高级应用实战 mysqldump 是 MySQL 自带的命令行工具,用于创建数据库的逻辑备份。它生成一系列 SQL 语句,这些语句可以用来重建数据库的结构和内容。 阅读详情

相关推荐

数据结构与算法期中练习题答案:工程化拆解与自检指南

数据结构与算法是计算机科学的核心基础,涵盖线性结构、树、排序查找等关键模块。其原理在于通过合理组织数据与设计算法,提升程序效率与可维护性。掌握这些基础不仅有助于通过考试,更是工程实践中优化性能、解决复杂问题的关键。在准备期中考试、考研408或开发面试时,常需借助练习题巩固知识。然而,单纯背诵答案易忽略推导过程,导致换个题型就出错。本文以数据结构与算法期中练习题答案为例,将答案文档视为测试用例集,提供手算题与代码题的标准推导流程、自检脚本及常见避坑点,帮助读者通过工程化方法反查知识盲区,提升复习效率。

weixin_34414650的博客 459

手动备份数据库并进行文件传输及清理

上面是比较简单的实现方案,整体流程还存在一些问题,后续继续优化。

睡醒的猫的博客 228

【Excel VBA 编程】表格内自动生成进度条

在表格中生成进度条,进度条需要自适应单元格的宽度,根据不同进度区间变换颜色,并且按照进度数据大小显示其长短

wei1019的专栏 1519

mysqldump where子句使用

mysqldump 的 where 条件子句适用于这种情况:导出某张表的部分数据。 --where=name 参数详情: -w, --where=name Dump only selected records. Quotes are mandatory. 使用 where 条件的时候,引号是必须的。where 条件的使用和 sql 语句中 where 是相同的。 语法如下: 1.mysqldump -u username -p password -B dbname --tables tbl --wh

ShiShc 8558

Flotherm XT学习历程

大家好,通过半年的热仿真软件学习使用,最终发现最好用,最好上手的软件就是Flotherm XT,对新手非常友好,但由于软件近几年才发布,网上教程非常少,后面我将在这里持续分析软件使用心得,和大家一起学习。

xiaoredred的博客 6259

AGV路径规划实战:如何用Python+ROS实现激光SLAM导航(附避障代码)

本文提供了一份基于Python和ROS实现AGV激光SLAM导航的实战指南。内容涵盖从Docker环境搭建、激光雷达数据处理、Gmapping建图,到Move_Base全局/局部路径规划与TEB局部规划器配置的全流程。重点解析了如何通过参数调优实现稳定导航,并附带了紧急避障代码,帮助开发者快速构建具备自主路径规划与实时避障能力的AGV系统。

pepsi的博客 1234

mysql学习——mysqldump参数详解

[root@lzl ~]# mysqldump --help mysqldumpVer 10.13 Distrib 5.7.20, for linux-glibc2.12 (x86_64)--mysqldump版本信息 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.--版权所有 Oracle is a registered trademark of Oracle Cor...

liuzhilong的博客 854

HFSS实战:手把手教你设计一款小型化圆极化微带天线(附仿真文件)

本文详细介绍了使用HFSS设计小型化圆极化微带天线的完整流程,包括工程初始化、辐射贴片设计、仿真设置与优化等关键步骤。通过实战案例,帮助工程师掌握圆极化天线设计技巧,解决轴比控制和耦合馈电匹配等核心问题,适用于物联网终端和便携式设备应用。

weixin_32770423的博客 338

MySQL的命令工具(持续积累更新)

随着学习的深入,会发现MySQL也有很多命令工具方便我们的开发,这篇文章就用来记录我学习过程中对MySQL工具的一些积累: 一、mysqlcheck MySQL mysqlcheck客户端主要用来检查(check)、修复(repair)、分析(analyze)、优化(optimize)表。使用mysqlcheck的好处是不需要停止服务器来检查或修复表,mysqlcheck为用户提供了一种方便的使用SQL语句CHECK TABLE、REPAIR TABLE、ANALYZE TABLE和OPTIMIZE TAB

qq_16268979的博客 444

Windows10环境下激活虚拟环境报错【source : 无法将“source”项识别为 cmdlet、函数、脚本文件或可运行程序的名称】

在使用Django创建Web程序前,需要创建一个虚拟的工作环境,在使用【source ll_env/bin/activate】命令激活虚拟环境时报错:source : 无法将“source”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。所在位置 行:1 字符: 2。

提供C#相关开发 、云计算、运维测试、网络安全相关技术分享与服务,有意向可联系。 1万+

基于轻量化网络的干扰信号智能识别算法

针对干扰信号识别时卷积神经网络模型体积大、训练周期长、对硬件存储和计算要求高等问题,本 文提出了一种基于改进轻量级网络模型 SqueezeNet 的干扰信号智能识别算法。该方法首先利用距离多普勒 (Range‑Doppler,RD)处理获得目标及干扰信号的RD图像,接着采用滑窗变换、归一化等技术对RD图像进行重 塑;然后采用基于 RD 信息尺寸的隐层和通道剪枝措施对 SqueezeNet 网络进行改进,缩小了模型尺寸和存储空 间;最后利用不同参数的测试样本拓展网络模型的泛化性能。

qq_43416206的博客 545

mysqldump日常应用

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34209406的博客 96

【表面缺陷检测】基于yolov5的钢轨表面缺陷检测(附代码和数据集,Windows系统)

【表面缺陷检测】基于yolov5的钢轨表面缺陷检测(附代码和数据集,Windows系统)

学无止境、积少成多、厚积薄发 3984

mysqldump简单应用

只导出数据 mysqldump -c -t -hmysqlIp 数据库名 -uroot -p >test.sql 只导出表结构 mysqldump -c -d-hmysqlIp 数据库名 -uroot -p >test.sql 导出文件后还原: 连接数据库: mysql -hmysqlIp -P端口号 -uroot -p source /data/*.sql 根据in...

weixin_42181749的博客 208

FanucROBOGUIDE软件二次开发:使用ROBOGUIDEAPI进行编程

菜单栏:位于界面顶部,提供文件、编辑、视图、插入、格式、工具、窗口和帮助等选项。工具栏:包含常用的工具按钮,如新建、打开、保存、运行、停止、机器人控制等。工作站视图:显示工作站的3D模型,用户可以在这里放置机器人、工件、工具和其他设备。机器人控制面板:用于控制机器人运动,包括手动移动、程序编辑和运行。程序编辑器:在这里可以编写和编辑机器人程序,支持Fanuc的R-30iB Plus和R-30iB控制柜的程序格式。状态栏:显示当前工作站的状态信息,如机器人位置、程序状态等。

kkchenjj的博客 1408

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

MySQL mysqldump命令的正确应用

MySQLmysqldump命令在实际中的应用比例还是占为多数的,如果你对这一技术,心存好奇的话,以下的文章将会揭开它的神秘面纱。希望会给你带来一些帮助在以后的学习或是工作中。 1.用MySQL mysqldump对MySQL数据库进行数据备份与恢复 下面假设要备份tm这个数据库: Shell>mysqldump -uroot –p123456 tm > tm_050519.sql 这时可

lampsunny的专栏 598

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

mysqldump应用

导出表名包含中文的单表 (字符集设置非常重要,在windows下,mysqldump接收中文表名时会报couldn't find table错误,即使表本身存在) mysqldump -uroot -proot -P8866 --default-character-set=gb2312 hive c客户信息表_copy > C:\1.sql 导出hive库中的存储过程(-R)、事件(-...

未来将会如何 256

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

mysqldump具体应用实例

1.导出整个数据库  mysqldump -h主机 -u 用户名 -p 数据库名 > 导出的文件名      mysqldump -h127.0.0.1 -u wcnc -p smgp_apps_wcnc --opt> wcnc.sql 2.导出一个表  mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名  mysqldump -u wcnc -p smgp_...

weixin_33922670的博客 135

【Mysql】mysqldump 导出各种场景的应用

因为一个开发问有关mysql字符集转换的问题,一下子牵连出mysql数据库的迁移-导入,导出,更改字符集,my.cnf参数配置等等知识点,花一些时间来逐个整理一下!(作为一个oracle 的小小dba,表示要学习的知识还有灰常多...

cojm55771的博客 142

MySqldump 应用

备份MySQL数据库的命令<br />mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql备份MySQL数据库为带删除表的格式<br />  备份MySQL数据库为带删除表的格式,能够让该备份覆盖已有数据库而不需要手动删除原有数据库。<br />mysqldump -–add-drop-table -uusername -ppassword databasename > backupfile.sql直接将MySQL数

怡红快绿 616

Mysqldump参数说明及导入导出应用实例

Mysqldump参数(参数来源于mysql5.5.19源码)   参数 参数说明 --all-databases  , -A 导出全部数据库。 mysqldump  -uroot -p --all-databases --all-tablespaces  , -Y 导出全部表空间。 mysqldump  -uroot -p --all-dat

李晓蒙的博客 1258

MySQLDump 使用教程

MySQLDump 使用教程 项目介绍 MySQLDump 是一个用于备份 MySQL 数据库的命令行工具。它可以将数据库、表或特定数据导出为 SQL 脚本,便于数据迁移和备份。该项目是基于 MySQL 官方提供的 mysqldump 工具进行扩展和优化的开源项目。 项目快速启动 安装 首先,确保你已经安装了 MySQL。然后,你可以通过以下命令安装 mysqldump: git clone ht...

gitblog_00813的博客 390

MYSQLDUMP在企业级数据库备份中的实战应用

最惊喜的是部署功能,点击按钮就能把管理系统发布到线上,完全不需要操心服务器配置,这对我们这种没有专职运维的团队简直是救命稻草。整个系统分为三个主要模块:配置管理模块负责设置备份参数,任务调度模块处理定时执行,监控报警模块确保备份可靠性。今天想和大家分享一个企业级MySQL数据库备份管理系统的实战开发经验。这个项目源于我们公司实际遇到的数据库管理痛点,通过MYSQLDUMP命令为核心,打造了一套完整的备份解决方案。平台提供的实时预览功能,让我们在开发管理界面时能立即看到效果,大大提升了开发效率。

EmeraldEagle36的博客 417
上一篇: linux 命令搜集-2
下一篇: mysql 常有语句
staffrobot
博客等级 码龄19年 6粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值