MySQL Tutorial/MySQL Utilities/mysqldump
Содержание
- 1 Automatically drop any tables that exist before restoring the stored tables with the " --add-drop-table "
- 2 Create the database if it doesn"t already exist with "--databases" option to specify the database we wish to back up
- 3 mysqldump
- 4 Optimising a dump
- 5 Restoring a Dump
- 6 To make a copy of live data
- 7 Using mysqldump to copy databases
Automatically drop any tables that exist before restoring the stored tables with the " --add-drop-table "
<source lang="sql">
c:\mysql\bin\mysqldump -u root -p --add-drop-table myDatabase > myDatabase.sql</source>
Create the database if it doesn"t already exist with "--databases" option to specify the database we wish to back up
<source lang="sql">
c:\mysql\bin\mysqldump -u root -p --databases myDatabase > myDatabase.sql</source>
mysqldump
mysqldump outputs the table structure and data in series of SQL commands stored in a text file.
The simplified syntax is
<source lang="sql">c:\mysql\bin\mysqldump -u <username> -p <database> [