Mysqldump Export single table data and structure statements in MySQL

Source: Internet
Author: User

Mysqldump Backup command
-uroot Root User
-p123456 Password is 123456
The database where the MyDB table resides MyDB
MYTB the table that will be exported MYTB
>/opt/mytb.sql Backup to Mytb.sql

Export the entire database

The code is as follows Copy Code

Mysqldump–opt-uroot-ppassword Database > Dump.sql


How do I export it?

Export a single datasheet table

The code is as follows Copy Code

Mysqldump–opt–add-drop-table-uroot-ppassword database table > Dump.sql

Or

Don't forget to write the table name if you want to export only the table structure and data of the table Test1,test2,test3

The code is as follows Copy Code

Mysqldump-uroot-p-D databasename test1 test2 test3 > Createtab.sql,

Linux system

The code is as follows Copy Code
#/usr/local/mysql/bin/mysqldump-uroot-p123456 MyDB MYTB >/opt/mytb.sql

Restores:

The code is as follows Copy Code
#/usr/local/mysql/bin/mysql-uroot-p123456 MyDB </opt/mytb.sql
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.