Export and Import mysql data in linux _ MySQL

Source: Internet
Author: User
Export all data in the database. 1. input mysqldump-uuserName-pdabaseNamefileNamesqlfileNamesql in the linux command line to export the data of a table in the database with the path name mysqldump-uuserName. Export all data in the entire database

1. enter the following in the linux command line:

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

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

Export all table structures in the entire database

In the linux command line, enter:

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:

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

Note:-d is added.

Import mysql method 1

Go to the linux command line:

Mysql-uroot-p Press enter and enter the password source fileName. SQL. Note that fileName. SQL requires a path name, for example, source/home/user/data/fileName. SQL.

Method 2 for importing mysql

Go to the linux command line:

Mysql-uroot-p database <fileName. SQL note that fileName. SQL must have a path name

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.