日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > 数据库 >内容正文

数据库

mysql dba系统学习(16)mysql的mysqldump备份

發(fā)布時(shí)間:2025/3/21 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql dba系统学习(16)mysql的mysqldump备份 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

mysql數(shù)據(jù)庫(kù)的備份恢復(fù)

mysqldump備份數(shù)據(jù)庫(kù)

?-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.


?-e, --extended-insert

? ? ? ? ? ? ? ? ? ? ?Use multiple-row INSERT syntax that include several

? ? ? ? ? ? ? ? ? ? ?VALUES lists. ?多行插入數(shù)據(jù)


? ? 為了保證數(shù)據(jù)的一致性,我們要把表鎖起來(lái)在dump

-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.

? ? ? ? ? ? ? ?

-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.



--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.


-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.


?-q, --quick ? ? ? ? Don't buffer query, dump directly to stdout. ? 不緩存



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



?--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.

實(shí)踐之非事務(wù)性一直備份(備份期間數(shù)據(jù)庫(kù)不可寫(xiě))

mysql> use ?test

mysql> create table tt(id int,name varchar(12));

Query OK, 0 rows affected (0.11 sec)

mysql> insert into tt values(1,'zz');

Query OK, 1 row affected (0.01 sec)

mysql> insert into tt values(2,'yy');

Query OK, 1 row affected (0.00 sec)


[root@test4 Desktop]# mysqldump ?--databases test ?--skip-opt --quick --extended-insert=false --lock-all-tables --master-data=2 ?-u root -p123456 > ?/tmp/test.sql

? 這就是dump的結(jié)果

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [root@test4 Desktop]# cat /tmp/test.sql -- MySQL dump?10.13??Distrib?5.1.70,?for?unknown-linux-gnu (x86_64) -- -- Host: localhost??? Database: test -- ------------------------------------------------------ -- Server version???5.1.70-log /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Position to start replication or point-in-time recovery from -- -- CHANGE MASTER TO MASTER_LOG_FILE='mysqlbin.000166', MASTER_LOG_POS=798; -- -- Current Database: `test` -- CREATE DATABASE?/*!32312 IF NOT EXISTS*/?`test`?/*!40100 DEFAULT CHARACTER SET utf8 */; USE `test`; -- -- Table structure?for?table `tt` -- /*!40101 SET @saved_cs_client???? = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tt` ( ??`id`?int(11) DEFAULT NULL, ??`name`?varchar(12) DEFAULT NULL ); /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data?for?table `tt` -- INSERT INTO `tt` VALUES (1,'zz'); INSERT INTO `tt` VALUES (2,'yy'); /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on?2013-09-05?20:15:38

? ? ?由于我們dump的時(shí)候用了master-data參數(shù),這個(gè)時(shí)候記錄了日志位置和日志文件名

-- CHANGE MASTER TO MASTER_LOG_FILE='mysqlbin.000166', MASTER_LOG_POS=798;

實(shí)踐之事務(wù)性一直備份(備份期間數(shù)據(jù)庫(kù)可寫(xiě))

mysql> use ?test

mysql> create table tt(id int,name varchar(12)) engine=innodb ;

Query OK, 0 rows affected (0.11 sec)

mysql> insert into tt values(1,'zz');

Query OK, 1 row affected (0.01 sec)

mysql> insert into tt values(2,'yy');

Query OK, 1 row affected (0.00 sec)


[root@test4 Desktop]# mysqldump ?--databases test ?--skip-opt --quick --extended-insert=false ?--single-transaction ??--master-data=2 ?-u root -p123456 > ?/tmp/test.sql

總結(jié)

以上是生活随笔為你收集整理的mysql dba系统学习(16)mysql的mysqldump备份的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产人妖在线播放 | 国产区一二 | 极品销魂美女一区二区三区 | 国产精品23p| 亚洲第一二三区 | 久久在线精品视频 | 中国少妇做爰全过程毛片 | 亚洲免费人成 | 中字幕一区二区三区乱码 | 亚洲成人系列 | 中文字幕在线视频精品 | 国产精品久久久久久久久久久久久久久久久 | 无码免费一区二区三区 | 在线观看国产小视频 | 亚洲精品白虎 | 亚洲婷婷av | 黑帮大佬和我的三百六十五天 | 成人在线免费 | 国产中文字幕在线免费观看 | 国产精品自偷自拍 | 欧美男人又粗又长又大 | 日韩精品一级 | 极品在线播放 | 在线观看一区 | 国产乱码精品一区二区 | 日韩欧美中文字幕精品 | 中文字幕在线观看线人 | 无码人妻丰满熟妇区毛片18 | 深夜福利网站在线观看 | 伊人网av在线 | 国产一区二区内射 | 香港三日本三级少妇66 | 日韩欧美一区二区三区在线 | 国产极品探花 | 亚洲一级片在线观看 | 男生草女生视频 | 嫩草午夜少妇在线影视 | 天堂av一区二区三区 | 国产精品国产三级国产Av车上的 | 福利社av| 97超碰免费在线 | 日本午夜视频在线观看 | 男操女视频在线观看 | 人妻体体内射精一区二区 | 双女主黄文 | 九九久视频 | 少妇免费毛片久久久久久久久 | 亚洲国产综合视频 | www国产成人| 亚洲小说区图片区都市 | 99在线免费观看视频 | 999精彩视频 | 欧美永久| 少妇一级视频 | 久久成人乱码欧美精品一区二区 | 欧美成人精品在线视频 | 国产69精品久久 | 国产精品一区二区三区在线看 | 亚洲欧美日韩图片 | 黄色国产一级片 | 日韩av中文字幕在线播放 | 和黑帮大佬的365 | 国产黄色在线 | 国内激情 | 欧美二区在线观看 | 国产又粗又黄的视频 | 亚洲专区第一页 | 中国黄色在线视频 | 女人做爰全过程免费观看美女 | 色香五月 | 91视频最新入口 | 欧美日韩亚洲综合 | 超碰2021 | 国产精选视频在线观看 | 办公室大战高跟丝袜秘书经理ol | 在线欧美一区二区 | 日韩精品一区二区三区 | 亚洲 日本 欧美 中文幕 | 邻家有女4完整版电影观看 欧美偷拍另类 | 日韩在线你懂的 | 男生插女生的网站 | 国产免费黄 | 久久综合av | 狠狠干天天爱 | 玖玖热视频 | 黑人性生活视频 | 久久亚洲精华国产精华液 | 91麻豆网站 | 欧美黑人xxxⅹ高潮交 | 久久久久成人网站 | 超碰免费在线观看 | 亚洲天堂午夜 | 成人免费视频观看视频 | av操操操 | 日韩乱码人妻无码系列中文字幕 | 天天摸夜夜操 | av在线a| 亚洲黄色小视频 | xxxx69视频|