Use mysql mysqldump command to export and import data

Source: Internet
Author: User

Many of our friends prefer to use third-party tools to import and export data. In fact, our mysql comes with this tool, as long as it can be operated in command mode, of course, it can also be used in php. The method is the same as below. If you need it, refer to it.

Back up database

 

The Code is as follows: Copy code
# Mysqldump Database Name> Database Backup name
# Mysqldump-A-u username-p Password Database Name> Database Backup name
# Mysqldump-d-A -- add-drop-table-uroot-p> xxx. SQL

Export Data Structure

The Code is as follows: Copy code

Mysqldump -- opt-d database name-u root-p> xxx. SQL

Export all, including data and data structure

 

The Code is as follows: Copy code
Mysqldump database name-uroot-p> xxx. SQL


Use source to import data

 

The Code is as follows: Copy code
# Mysql database name <file name
# Source/tmp/xxx. 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.