MySQL Import and export database (with remote import Export)

Source: Internet
Author: User
Tags one table mysql import

I. Import and export the local database
Export:

1. Run CMD,CD to the Bin folder in the MySQL installation directory first

2, mysqldump-u root-p database name > Export file name. sql

In other cases:

1. Export the entire database
Mysqldump-u user name-p database name > exported file name
Mysqldump-uwcnc-p SMGP_APPS_WCNC > Wcnc.sql
2. Export a table
Mysqldump-u user name-P database name Table name > exported file name
Mysqldump-uwcnc-p SMGP_APPS_WCNC users> Wcnc_users.sql
3. Export a database structure
Mysqldump-uwcnc-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

Import:

1, DOS command to enter the SQL: first create database name;

2, use database;

3. sourcec:\....\ file name. sql, no semicolon required after

II. remote Import and Export database (or table)

The remote export syntax is:
Mysqldump-h[hosname]-u[user_name]-p[password]--default-character-set=[char_set_name] [db_name] >[save_ Path]
Example: then enter: Mysqldump-h119.12.12.11-umysql-pmysql123--default-character-set=utf8 aspchina--skip-lock-tables>d:\ Aspchina_net.sql

You can also:mysqldump-h119.12.12.11-u mysql >d:\aspchina_net.sql

119.12.12.11 for the remote server ip,-umysql mysql for the database user name,-pmysql123 (no space interval) mysql123 for the user password, Set=utf8 to export the MySQL encoding format, Aspchina is the name of the database to be exported, >d:\aspchina_net.sql is the import to your local storage path, aspchina_net.sql you can freely name!

Remote Database import:

If the MySQL database is less than 2MB can be imported with mysqldump management tools, if the size of 2MB will not be, because the space provider provides phpMyAdmin management tools can generally only import less than 2MB of data, which makes some webmasters using MySQL database depressed!
Now let's teach you how to import data larger than 2MB using the mysqldump management tool.
1) Run->cmd in the lower left corner Start menu to enter the DOS command line status
2) D:\Program Files\mysql\mysql server5.0\bin> installs the MySQL installation directory for you, \ bin for the Mysqldump management tool all in the directory;
3) then enter:mysql-h119.12.12.11-uaspchina-paspchina123456aspchina< d:\aspchina_net.sql
Note: Aspchina_net.sql, if the user does not have the right to create a database will not be able to import the Aspchina_net.sql database, or spchina_net.sql can only be more than one table or will be wrong, remember!

MySQL Import and export database (with remote import Export)

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.