Export and Import mysql Data in linux

Source: Internet
Author: User

Export and Import mysql Data in linux

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.