MYSQLDUMP TABLE IN SQL FORMAT
发表于:2025-01-19 作者:千家信息网编辑
千家信息网最后更新 2025年01月19日,MYSQLDUMP TABLE IN SQL FORMAT1.What is mysqldump ?mysqldump is a sql based dump, data is dumped then
千家信息网最后更新 2025年01月19日MYSQLDUMP TABLE IN SQL FORMATMYSQLDUMP 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 ##
/*!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 */;
/*!40101 SET NAMES utf8 */;
/*!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 */;
--
-- Table structure for table `doudou01`
--
DROP TABLE IF EXISTS `doudou01`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `doudou01` (
`i` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`i`)
) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=gbk;
/*!40101 SET character_set_client = @saved_cs_client */;
## create table statement ##
--
-- Dumping data for table `doudou01`
--
LOCK TABLES `doudou01` WRITE;
/*!40000 ALTER TABLE `doudou01` DISABLE KEYS */;
INSERT INTO `doudou01` VALUES (2),(22),(35);
/*!40000 ALTER TABLE `doudou01` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
## export table data to sql-format ##
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- 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工作经验,寻求新工作机会 *********
########################################################################################
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 ##
/*!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 */;
/*!40101 SET NAMES utf8 */;
/*!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 */;
--
-- Table structure for table `doudou01`
--
DROP TABLE IF EXISTS `doudou01`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `doudou01` (
`i` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`i`)
) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=gbk;
/*!40101 SET character_set_client = @saved_cs_client */;
## create table statement ##
--
-- Dumping data for table `doudou01`
--
LOCK TABLES `doudou01` WRITE;
/*!40000 ALTER TABLE `doudou01` DISABLE KEYS */;
INSERT INTO `doudou01` VALUES (2),(22),(35);
/*!40000 ALTER TABLE `doudou01` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
## export table data to sql-format ##
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- 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工作经验,寻求新工作机会 *********
########################################################################################
链接
工作
地址
工作机会
文章
方式
机会
法律
法律责任
版权
版权所有
经验
责任
交流
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
没经验怎么做软件开发人员
中兴软件开发好跳槽吗
奥鹏数据库技术与管理考试平台
数据库选择查询系统
手抄报我眼中的网络安全
神经网络服务器硬件配置
登录页面怎么连接数据库
多个服务器负载均衡
色彩丰富网络安全手抄报
如何解决谷歌服务器超时问题
信息网络安全教育证书
老牌的重庆虚拟主机服务器
工行软件开发中心好跳槽吗
惠普无线打印服务器
论坛整站数据库sql下载
初创软件开发
维护所述数据库
创建有特殊符号的数据库
楚雄彝族自治州互联网科技贵不贵
综合布线计算机网络技术交底
大学生网络安全量表
r420服务器尺寸多少合适
合专利数据库
文科能报软件开发吗
网络安全马克笔
服务器界面怎么做raid
html链接数据库实现登录
bim协同管理平台服务器
河北天驱企业级服务器云服务器
大势山东软件开发