mysqldump 导出数据表,和数据
Posted 认真生活、快乐工作 - 马云
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysqldump 导出数据表,和数据相关的知识,希望对你有一定的参考价值。
导出数据库表与数据。
mysqldump -uroot -p caomall>tmp.sql
导出数据表数据。
mysqldump -uroot -p caomall tf_my_business>tmp.sql
导出多个表数据。
mysqldump -uroot -p caomall tf_my_business tf_my_business_img>tmp.sql
-- MySQL dump 10.13 Distrib 5.6.36, for Linux (x86_64)
--
-- Host: localhost Database: caomall
-- ------------------------------------------------------
-- Server version 5.6.36-log
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tf_my_business`
--
DROP TABLE IF EXISTS `tf_my_business`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tf_my_business` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`name` varchar(128) NOT NULL COMMENT '商家名称',
`info` text NOT NULL COMMENT '商家介绍',
`connect_user` varchar(16) NOT NULL COMMENT '联系人',
`connect_tel` varchar(16) NOT NULL COMMENT '联系电话',
`province_id` int(11) NOT NULL,
`province_name` varchar(16) NOT NULL,
`city_id` int(11) NOT NULL,
`city_name` varchar(16) NOT NULL,
`area_id` int(11) NOT NULL,
`area_name` varchar(16) NOT NULL,
`street` varchar(128) NOT NULL,
`lng` float NOT NULL COMMENT '经度',
`lat` float NOT NULL COMMENT '纬度',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0待审核 1审核通过 2审核未通过',
`createtime` int(11) NOT NULL COMMENT '创建时间',
`updatetime` int(11) NOT NULL COMMENT '修改时间',
`checktime` int(11) DEFAULT NULL COMMENT '审核时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='我的商家表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tf_my_business`
--
LOCK TABLES `tf_my_business` WRITE;
/*!40000 ALTER TABLE `tf_my_business` DISABLE KEYS */;
INSERT INTO `tf_my_business` VALUES (3,8,'京东','京东','刘强东','17712731900',10370,'江苏省',11805,'宿迁市',11806,'宿城区','京东\n',118.353,33.9584,0,1524732826,1524732826,NULL);
/*!40000 ALTER TABLE `tf_my_business` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tf_my_business_img`
--
DROP TABLE IF EXISTS `tf_my_business_img`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tf_my_business_img` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`m_b_id` int(11) NOT NULL COMMENT '我的商家表id',
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型,0为营业执照等,1为商家照片',
`img` varchar(128) NOT NULL,
`is_main` tinyint(4) NOT NULL DEFAULT '0' COMMENT '商家照片类型,是否是主图.1为主图,0为非主图',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='我的商家图片表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tf_my_business_img`
--
LOCK TABLES `tf_my_business_img` WRITE;
/*!40000 ALTER TABLE `tf_my_business_img` DISABLE KEYS */;
INSERT INTO `tf_my_business_img` VALUES (9,3,0,'15247327981170096930.png',0),(10,3,0,'15247327982066688699.png',0),(11,3,1,'1524732806744365022.png',1),(12,3,1,'1524732806709848922.jpg',0);
/*!40000 ALTER TABLE `tf_my_business_img` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET [email protected]_TIME_ZONE */;
/*!40101 SET [email protected]_SQL_MODE */;
/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
/*!40014 SET [email protected]_UNIQUE_CHECKS */;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
/*!40111 SET [email protected]_SQL_NOTES */;
-- Dump completed on 2018-04-26 17:02:12
只导出数据。
mysqldump -uroot -p --no-create-info caomall tf_my_business tf_my_business_img>tmp.sql
-- MySQL dump 10.13 Distrib 5.6.36, for Linux (x86_64)
--
-- Host: localhost Database: caomall
-- ------------------------------------------------------
-- Server version 5.6.36-log
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `tf_my_business`
--
LOCK TABLES `tf_my_business` WRITE;
/*!40000 ALTER TABLE `tf_my_business` DISABLE KEYS */;
INSERT INTO `tf_my_business` VALUES (3,8,'京东','京东','刘强东','17712731900',10370,'江苏省',11805,'宿迁市',11806,'宿城区','京东\n',118.353,33.9584,0,1524732826,1524732826,NULL);
/*!40000 ALTER TABLE `tf_my_business` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `tf_my_business_img`
--
LOCK TABLES `tf_my_business_img` WRITE;
/*!40000 ALTER TABLE `tf_my_business_img` DISABLE KEYS */;
INSERT INTO `tf_my_business_img` VALUES (9,3,0,'15247327981170096930.png',0),(10,3,0,'15247327982066688699.png',0),(11,3,1,'1524732806744365022.png',1),(12,3,1,'1524732806709848922.jpg',0);
/*!40000 ALTER TABLE `tf_my_business_img` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET [email protected]_TIME_ZONE */;
/*!40101 SET [email protected]_SQL_MODE */;
/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
/*!40014 SET [email protected]_UNIQUE_CHECKS */;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
/*!40111 SET [email protected]_SQL_NOTES */;
-- Dump completed on 2018-04-26 17:08:16
只导出创建表的数据。
mysqldump -uroot -p --no-data caomall tf_my_business tf_my_business_img>tmp.sql
-- MySQL dump 10.13 Distrib 5.6.36, for Linux (x86_64)
--
-- Host: localhost Database: caomall
-- ------------------------------------------------------
-- Server version 5.6.36-log
/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @[email protected]@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @[email protected]@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @[email protected]@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tf_my_business`
--
DROP TABLE IF EXISTS `tf_my_business`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tf_my_business` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`name` varchar(128) NOT NULL COMMENT '商家名称',
`info` text NOT NULL COMMENT '商家介绍',
`connect_user` varchar(16) NOT NULL COMMENT '联系人',
`connect_tel` varchar(16) NOT NULL COMMENT '联系电话',
`province_id` int(11) NOT NULL,
`province_name` varchar(16) NOT NULL,
`city_id` int(11) NOT NULL,
`city_name` varchar(16) NOT NULL,
`area_id` int(11) NOT NULL,
`area_name` varchar(16) NOT NULL,
`street` varchar(128) NOT NULL,
`lng` float NOT NULL COMMENT '经度',
`lat` float NOT NULL COMMENT '纬度',
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 0待审核 1审核通过 2审核未通过',
`createtime` int(11) NOT NULL COMMENT '创建时间',
`updatetime` int(11) NOT NULL COMMENT '修改时间',
`checktime` int(11) DEFAULT NULL COMMENT '审核时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='我的商家表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tf_my_business_img`
--
DROP TABLE IF EXISTS `tf_my_business_img`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tf_my_business_img` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`m_b_id` int(11) NOT NULL COMMENT '我的商家表id',
`type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类型,0为营业执照等,1为商家照片',
`img` varchar(128) NOT NULL,
`is_main` tinyint(4) NOT NULL DEFAULT '0' COMMENT '商家照片类型,是否是主图.1为主图,0为非主图',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='我的商家图片表';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET [email protected]_TIME_ZONE */;
/*!40101 SET [email protected]_SQL_MODE */;
/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
/*!40014 SET [email protected]_UNIQUE_CHECKS */;
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
/*!40101 SET [email protected]_COLLATION_CONNECTION */;
/*!40111 SET [email protected]_SQL_NOTES */;
-- Dump completed on 2018-04-26 17:16:59
参考:
https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
以上是关于mysqldump 导出数据表,和数据的主要内容,如果未能解决你的问题,请参考以下文章