返回顶部
首页 > 资讯 > 数据库 >MYSQLDUMP TABLE IN SQL FORMAT
  • 491
分享到

MYSQLDUMP TABLE IN SQL FORMAT

2024-04-02 19:04:59 491人浏览 薄情痞子
摘要

MysqlDUMP TABLE IN sql FORMAT 1.What is mysqldump ? mysqldump is a sql based dump, data is dumped th

MysqlDUMP TABLE IN sql FORMAT


1.What is mysqldump ?
mysqldump is a sql based dump, data is dumped then loaded and all indexes are recreated. During mysqldump, all the tables would be locked and will not be accessible for queries.


2.Create test table doudou01 and doudou02
mysql> select * from doudou01;
+----+
| i  |
+----+
|  2 |
| 22 |
| 35 |
+----+
3 rows in set (0.00 sec)


3.list of mysqldump sql
[root@dbdou02 ~]# mysqldump -pDoudou123! test doudou01
Warning: Using a passWord on the command line interface can be insecure.
-- MySQL dump 10.13  Distrib 5.6.29, for linux (x86_64)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version       5.6.29


## Basic information ##


;
;
;
;
;
;
;
;
;
;


--
-- Table structure for table `doudou01`
--


DROP TABLE IF EXISTS `doudou01`;
;
;
CREATE TABLE `doudou01` (
  `i` bigint(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`i`)
) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=gbk;
;
## create table statement ##
--
-- Dumping data for table `doudou01`
--


LOCK TABLES `doudou01` WRITE;
;
INSERT INTO `doudou01` VALUES (2),(22),(35);
;
UNLOCK TABLES;
;
## export table data to sql-format ##


;
;
;
;
;
;
;


-- Dump completed on 2016-03-18 15:02:09






4.backup using mysqldump
[root@dbdou02 ~]# mysqldump -uroot -p test doudou01 >doudou01.sql
[root@dbdou02 ~]# mysqldump -uroot -p test doudou02 >doudou02.sql
[root@dbdou02 ~]# ls -l doudou*
-rw-r--r--. 1 root root 1866 Mar 21 11:14 doudou01.sql
-rw-r--r--. 1 root root 2102 Mar 21 11:14 doudou02.sql


5.reloading SQL-Format Backups
5.1 use mysqldump other database
mysql> use test1
Database changed
mysql> show tables;
Empty set (0.00 sec)
5.2 source dump.sql
mysql> source doudou01.sql
Query OK, 0 rows affected (0.00 sec)
...


Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0
...


mysql> source doudou02.sql
Query OK, 0 rows affected (0.00 sec)
...


Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0
...


5.3 check list reload tables
mysql> show tables;
+-----------------+
| Tables_in_test1 |
+-----------------+
| doudou01        |
| doudou02        |
+-----------------+
2 rows in set (0.00 sec)


mysql> select * from doudou01;
+----+
| i  |
+----+
|  2 |
| 22 |
| 35 |
+----+
3 rows in set (0.00 sec)


mysql> select * from doudou02;
+------------+---------+---------------------+
| country_id | country | last_update         |
+------------+---------+---------------------+
|          1 | doudou  | 2016-03-18 14:47:59 |
|          2 | dba     | 2016-03-18 14:47:59 |
|          3 | nba     | 2016-03-18 14:47:59 |
+------------+---------+---------------------+
3 rows in set (0.01 sec)


6.It's Successly !


########################################################################################
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!【QQ交流群:53993419】
QQ:14040928 E-mail:dbadoudou@163.com
本文链接: Http://blog.itpub.net/26442936/viewspace-2060811/
********* 6年DBA工作经验,寻求新工作机会 *********
########################################################################################






您可能感兴趣的文档:

--结束END--

本文标题: MYSQLDUMP TABLE IN SQL FORMAT

本文链接: https://lsjlt.com/news/47996.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作