Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mysqldump only to back up the table structure

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to use mysqldump only backup table structure, the content is very detailed, interested friends can refer to, I hope to help you.

Use the--no-data option, for example:

C:\Users\duansf\Desktop>mysqldump -uroot -p123456 --no-data --databases test > test.sql

test.sql reads as follows:

-- MySQL dump 10.13 Distrib 5.5.13, for Win32 (x86)

--

-- Host: localhost Database: test

-- ------------------------------------------------------

-- Server version 5.5.13

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

--

-- Current Database: `test`

--

CREATE DATABASE /*! 32312 IF NOT EXISTS*/ `test` /*! 40100 DEFAULT CHARACTER SET gbk */;

USE `test`;

--

-- Table structure for table `workinfo`

--

DROP TABLE IF EXISTS `workinfo`;

/*! 40101 SET @saved_cs_client = @@character_set_client */;

/*! 40101 SET character_set_client = utf8 */;

CREATE TABLE `workinfo` (

`id` int(10) NOT NULL AUTO_INCREMENT,

`name` varchar(20) NOT NULL,

`type` varchar(10) DEFAULT NULL,

`address` varchar(50) DEFAULT NULL,

`tel` varchar(20) DEFAULT NULL,

`wages` int(11) DEFAULT NULL,

`contents` tinytext,

`extra` text,

PRIMARY KEY (`id`),

UNIQUE KEY `id` (`id`),

UNIQUE KEY `index_id` (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

/*! 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 2016-08-11 14:56:15

About how to use mysqldump only backup table structure to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report