mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 16:48:01 +00:00
Add Dump A Database To A File as a mysql til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||||
|
|
||||||
_537 TILs and counting..._
|
_538 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -232,6 +232,7 @@ _537 TILs and counting..._
|
|||||||
### MySQL
|
### MySQL
|
||||||
|
|
||||||
- [Display Output In A Vertical Format](mysql/display-output-in-a-vertical-format.md)
|
- [Display Output In A Vertical Format](mysql/display-output-in-a-vertical-format.md)
|
||||||
|
- [Dump A Database To A File](mysql/dump-a-database-to-a-file.md)
|
||||||
- [List Databases And Tables](mysql/list-databases-and-tables.md)
|
- [List Databases And Tables](mysql/list-databases-and-tables.md)
|
||||||
- [Show Indexes For A Table](mysql/show-indexes-for-a-table.md)
|
- [Show Indexes For A Table](mysql/show-indexes-for-a-table.md)
|
||||||
|
|
||||||
|
|||||||
20
mysql/dump-a-database-to-a-file.md
Normal file
20
mysql/dump-a-database-to-a-file.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Dump A Database To A File
|
||||||
|
|
||||||
|
The `mysqldump` client is a handy tool for creating a backup or snapshot of
|
||||||
|
a MySQL database. The standard use of this command produces an alphabetical
|
||||||
|
series of statements that comprise the structure and data of the specified
|
||||||
|
database. It directs all of this to `stdout`. You'll likely want to redirect
|
||||||
|
it to a file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ mysqldump my_database > my_database_backup.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
The output will include special comments with MySQL directives that disable
|
||||||
|
things like constraint checking. This is what allows the output to be in
|
||||||
|
alphabetical order without necessarily violating any foreign key
|
||||||
|
constraints.
|
||||||
|
|
||||||
|
If you need to dump multiple databases, include the `--databases` flag with
|
||||||
|
a space-separated list of database names. Or dump all of them with
|
||||||
|
`--all-databases`.
|
||||||
Reference in New Issue
Block a user