MySQL backup-mysqldump command

Source: Internet
Author: User
Tags mysql backup

If you load the contents of the entire database Meet_A_Geek to a file, you can use the following command:

Bin/mysqldump-p Meet_A_Geek> MeetAGeek_Dump_File.txt

This statement also allows you to specify a table for dump (backup/export/load ?). If you want to export the entire content of the table Orders in the database Meet_A_Geek to a file, run the following command:

Bin/mysqldump-p Meet_A_Geek Orders> MeetAGeek_Orders.txt

This is very flexible. You can even use the WHERE clause to select the records you need to export to the file. To achieve this purpose, you can use a command similar to the following:

Bin/mysqldump-p-where = "Order_ID> 2000" Meet_A_Geek Orders> Special_Dump.txt

This article from: (www.91linux.com) detailed source reference: http://www.91linux.com/html/article/database/mysql/20080109/9516.html

______________________________________________________________________________________________

 

1. Import and Export

1. mysql exports the entire database
Mysqldump-u username-p Password Database Name> exported file name

Mysqldump-u wcnc-p111111 smgp_rj_wcnc> wcnc. SQL

2. mysql exports a database table

Mysqldump-u user name-P database name Table Name> exported file name

Mysqldump-u wcnc-P smgp_rj_wcnc users> wcnc_users. SQL

3. MySQL exports a database structure

Mysqldump-u wcnc-p-d -- add-drop-Table smgp_apps_wcnc> D: wcnc_db. SQL

-D no data -- add-drop-table adds a drop table before each create statement.

4. Import MySQL database

Common source commands

Go to the MySQL Database Console,

For example, MySQL-u root-P

Mysql> Use Database

Then run the source command. The following parameter is the script file (for example,. SQL used here)

Mysql> source D: wcnc_db. SQL

2. Set the session character set encoding

Set names UTF-8;

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

Example of backing up a MySQL database (which can be regularly executed as a bat file ):

Cd "C: \ Program Files \ mysql server5.1 \ bin"
Mysqldump-uroot-p123456 test> test_backup. SQL
Echo "pause, press any key to exit"
Pause

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.