MySQL export database with command line

Source: Internet
Author: User

MySQL command line export database:
First go to cmd and then:
1. CD C:\Program Files (x86) \mysql\mysql Server 5.1\bin
2. mysqldump-uroot-p labos1502 > Labos1502.sql
3. When prompted for a password, enter the password for the database user name (if you export a single table, enter the table name after the database name)
If you are prompted locktable error: Then empty a grid after mysqldump-uroot-p ABC plus--skip-lock-tables
4. You will see the file Labos1502.sql automatically generated under the bin file?

================ Command window to copy things, first with the mouse tag, and then CTRL + C copied into the text;
================ to the command window paste things, first copy, with the mouse sticky into it;

MySQL command line Import Database:
1. The labos1502.sql file to be imported is moved to the bin file, such a path is more convenient
2.1th step with the above export
3.mysql-u root-p (input will also let you enter the MySQL password)
4, create the database you want to build in Mysql-front, and specify the character set, this is an empty database, such as a new target database named News
CREATE DATABASE labos1502 DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
show databases; Note that you must add a semicolon in English after the cmd window is running.
5. Create a database character set for a specified database
CREATE DATABASE labos1502 DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
6, Input: Mysql>use target database name Mysql>use labos1502;
7. import file: Mysql>source the name of the import, as I entered the command line: Mysql>source labos1502.sql;

MySQL backup and restore is done using the mysqldump, MySQL, and source commands.

MySQL export database with command line

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.