-
Notifications
You must be signed in to change notification settings - Fork 0
/
how-to-dump-or-export-all-the-table-definitions-in-a-mysql-database.html
104 lines (97 loc) · 3.93 KB
/
how-to-dump-or-export-all-the-table-definitions-in-a-mysql-database.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Dreams of thought</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/theme/styles.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="/theme/slicknav.css">
<script src="/theme/jquery.slicknav.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
<![endif]-->
<script>
$(function(){
$('#menu').slicknav({'label':''});
});
</script>
<link rel="icon" href="/theme/favicon.ico" sizes="16x16 32x32 48x48 64x64" type="image/vnd.microsoft.icon">
<link rel="apple-touch-icon" sizes="114x114" href="/theme/apple-touch-icon-precomposed.png">
<link rel="apple-touch-icon" sizes="152x152" href="/theme/favicon152.png">
<link rel="apple-touch-icon" sizes="196x196" href="/theme/favicon196.png">
</head>
<body>
<div id="wrapper">
<header>
<nav class="byline"><ul id="menu">
</ul></nav><!-- /#menu -->
<div class="downloads">
<a href="#" class="fa fa-Twitter"></a>
<a href="#" class="fa fa-Github"></a>
</div>
<hgroup>
<h1>How to dump or export all the table definitions in a MySQL database</h1>
<footer class="article-footer">
<address class="vcard author">
By <a class="url fn" href="./author/admin.html">admin</a>
</address>
<abbr class="published" title="2010-02-05T16:41:00+05:30">
on 05.02.2010
</abbr>
</footer><!-- /.post-info -->
</hgroup>
<meta name="tags" contents="mysql" />
<meta name="tags" contents="mysqldump" />
</header>
<section id="content" class="body article">
<div class="entry-content">
<p>So you have a database with loads of tables. You want the table
definitions of all of them. You don't really need the data.
<a class="reference external" href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">mysqldump</a> to
the rescue!</p>
<p>[sourcecode]mysqldump -u USERNAME --password=PASSWORD --no-data --opt
DB1 > DUMPFILE[/sourcecode]</p>
<p>That's it! Easy as a pie :) The key here is the --no-data option. It
dumps all the table definitions, but not the table data.</p>
<p>Want to do this for multiple databases? No problem.</p>
<p>[sourcecode]mysqldump -u USERNAME --password=PASSWORD --no-data --opt
--databases DB1 DB2 > DUMPFILE[/sourcecode]</p>
<p>The --databases option allows you to add multiple databases.</p>
<p>[sourcecode]mysqldump -u USERNAME --password=PASSWORD --no-data --opt
--all-databases > DUMPFILE[/sourcecode]</p>
<p>The --all-databases option allows you to dump all the databases.</p>
<p>[sourcecode]mysqldump -u USERNAME --password=PASSWORD --no-data --opt
DB1 --ignore-table DB1.TABLENAME1 --ignore-table DB1.TABLENAME2 >
DUMPFILE[/sourcecode]</p>
<p>--ignore-table option allows you to skip dumping certain tables. Do not
forget to specify the databasename when using this option.</p>
<p>Know any more tricks? Let us know in the comments below :)</p>
</div><!-- /.entry-content -->
<div class="article-share-tags">
<div class="end-article-tags">
<i class="fa fa-tags"></i>
<a href="./tag/mysql.html">mysql</a>
<a href="./tag/mysqldump.html">mysqldump</a>
</div>
<div class='article-share'>
share -
</div>
</div>
</section>
<div class="neighbors">
</div>
<footer>
<a href="./pages/about.html" >About</a>
<div class="right-footer">
<a href="./categories.html" >Categories</a>
<a href="./tags.html" >Tags</a>
</div>
</footer>
</body>
</html>