Import and export MySQL data using commands

Source: Internet
Author: User

1. Export all databases

Use Mysqldump's-all-databases parameter to export all the databases under your database root to a SQL file in one breath. Then, after reloading the system, use the source command to rewind back in a breath.

You need to determine the path to the MySQL installation: C:\Program files\mysql\mysql Server 5.7\bin, there is mysqldump.exe in this folder, so you can execute the mysqldump command.

Method: Enter the MySQL command line input: Show variables like "%char%";

Export all databases Mysqldump-uroot-p--all-databases > E:/sqlfile.sql

This will lead to all databases under the root user of the database server. If you are prompted after enter Password: Please enter your MySQL root password.

2. Export a Database

Mysqldump-u root-p test1 >e:/kuku1.sql

3. Import a Database

You need to determine the path to the MySQL installation: C:\Program files\mysql\mysql Server 5.7\bin, there is mysql.exe in this folder, so you can execute the MySQL command.

Login mysql:mysql–uroot–p, follow the prompts to enter the password

Create a database test3, in E:\kuku1.sql have this file

Select Test3 database: Use TEST3;

Input Import command: source E:\kuku1.sql;

Import and export MySQL data using commands

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.