MYSQL import and export, mysql Import and Export Database

Source: Internet
Author: User
Tags mysql import

MYSQL import and export, mysql Import and Export Database

Export all data in the entire database

1. Enter the following in the linux Command Line:

?
1 mysqldump -u userName -p  dabaseName  > fileName.sql

FileName. It is best to add the path name to SQL.

Export the data of a table in the database

?
1 mysqldump -u userName -p  dabaseName tableName > fileName.sql 

Export all table structures in the entire database

In the linux Command Line, enter:

?
1 mysqldump -u userName -p -d dabaseName  > fileName.sql

Note:-d is added.

Export the table structure of a table in the entire database

In the linux Command Line, enter:

?
1 mysqldump -u userName -p -d dabaseName tableName > fileName.sql

Note:-d is added.

Import mysql method 1

Go to the linux Command Line:

?
123 Mysql-uroot-p press enter to enter the passwordsource fileName.sqlNote that fileName. SQL must have a path name, for example, source/home/user/data/fileName.sql

Method 2 for importing mysql

Go to the linux Command Line:

?
12 mysql -uroot -p database< fileName.sqlNote that fileName. SQL must have a path name.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.