Introduction to common MySQL Export import commands

Source: Internet
Author: User
Tags import database phpmyadmin

Briefly describe the way the command line enters MySQL:
1.c:>mysql-h Hostname-u Username-p
Press ENTER to wait and then enter the password. Here hostname is the name of the server, such as the user name Localhost,username for MySQL, such as root.
After entering the command line, you can directly manipulate MySQL.


1. Export the entire database

Mysqldump-u user name-p database name > exported file name

The code is as follows Copy Code

Mysqldump-u wcnc-p SMGP_APPS_WCNC > Wcnc.sql

Mysqldump-u root-p aikersql> Aiker.sql


2. Export a table

Mysqldump-u user name-P database name Table name > exported file name

The code is as follows Copy Code

Mysqldump-u wcnc-p SMGP_APPS_WCNC users> wcnc_users.sql

3. Export a database structure

The code is as follows Copy Code

Mysqldump-u wcnc-p-d–add-drop-table SMGP_APPS_WCNC >d:wcnc_db.sql

-D No data –add-drop-table add a drop table before each CREATE statement

4. Import Database

Common source Commands

Enter the MySQL database console,

such as Mysql-u root-p

Mysql>use Database

Then use the source command, followed by the script file (such as the. SQL used here)

Mysql>source D:wcnc_db.sql

To transfer text data to a database
1, the text data should conform to the format: The field data is separated by the TAB key, null value with N to replace.
Cases:
3 Rose Shenzhen II 1976-10-10
4 Mike Shenzhen one 1975-12-23
2, Data incoming command load infile "filename" into table name;
Note: You'd better copy the files to the Mysqlbin directory and use the using command to hit the library where the table resides.
Data export

There are several main methods for data export:
Use SELECT INTO outfile "filename" statement
Using the Mysqldump utility
Import using phpMyAdmin
For example:mysql> SELECT * from driver into outfile "a.txt";

Import
Similar to exports, there are two ways to import:
Use the load DATA INFILE "filename" command
Using the Mysqlimport utility
Import using phpMyAdmin
Using SQL files

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.