Import and export commands for MySQL database

Source: Internet
Author: User
Tags mysql export database

MySQL Common Export Data command:
1.mysql exporting the entire database
mysqldump-u[user Name]-p [Database name]> [file name].sql

To illustrate:
Mysqldump-uroot-p salemanage> D:salemanage.sql

2.mysql Export Database A table
mysqldump-u[user Name]-p [database name] [table name]> [filename]].sql
Mysqldump-uroot-p salemanage t_user> D:user.sql

3.mysql Exporting a database structure
mysqldump-u[user Name]-p-d--add-drop-table [database name]>[file name].sql
-D No data--add-drop-table add a drop table before each CREATE statement

Mysqldump-uroot-p-D--add-drop-table salemanage > D:salemanageconstruct.sql

4. If you need to export a function or stored procedure inside MySQL
mysqldump-u[database name]-p-ntd-r [database name] > [File name].sql
Mysqldump-uroot-p-ntd-r salemanage > Salemanagefunction.sql
Where the-NTD is the export stored procedure;-R is a representation of the export function

MySQL common command to import data: During the import process, you should create a database and import it, or you will get an error.
1.mysql command
mysql-u[user Name]-p [Database name] < [filename].sql

Mysql-uroot-p Salemanage < Salemanage.sql
2.source command
Mysql>source Salemanage.sql; If you first select a database and then import it

Import and export commands for MySQL database

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.