码迷,mamicode.com
首页 > 数据库 > 详细

mysqldump 导出数据表,和数据

时间:2018-04-26 18:19:38      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:complete   lock   arch   联系电话   oat   sql_mod   inf   nec   mysq   

导出数据库表与数据。

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 @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 `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 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 */;
/*!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 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 @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 */;

--
-- 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 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 */;
/*!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 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 @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 `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 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 */;
/*!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 2018-04-26 17:16:59

参考:
https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

mysqldump 导出数据表,和数据

标签:complete   lock   arch   联系电话   oat   sql_mod   inf   nec   mysq   

原文地址:https://www.cnblogs.com/jiqing9006/p/8953797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!