CentOS MySQL Database Export Import

Source: Internet
Author: User
Tags wordpress database

The MySQL database import and export can be mysqldump with the database backup tool

The Mysqldump tool is a very handy gadget for MySQL, with the MySQL installation directory/usr/local/mysql/bin (CentOS) being under.

Like MySQL, Mysqldump is an application that you can't perform under MySQL. Remember, enter MYSQLDUMP–HELP to check for year-related information. Mysqldump can be executed directly under any directory.

First, export

Backing up the database with mysqldump
1 mysqldump -u用户 -p密码 数据库名 > (目录)导出文件名

such as: mysqldump-uroot-p123 dbname >/root/test.sql Enter to complete the backup directly.

If you only need to build a table directive, the command is as follows: Shell> mysqldump-u root-p-D dbname > Test.sql

If you only need SQL commands to insert data and do not need to create a table command, the command is as follows: shell> mysqldump-u root-p-T dbname > Test.sql

Backing up a single data table

Sometimes the database is very large, the whole library backup is not good management, then separate backup.

1 mysqldump -uroot -p123 dbname tablename >  /root/testtb.sql
Backing up multiple data tables

For example, back up the wp_posts table and wp_options table of the WordPress database to Wordpress_1.sql:

1 mysqldump -u root -p wordpress wp_posts wp_options > wordpress_1.sql
Mysqldump Remote Backup
1 mysqldump -h ip -uroot -p123 database > c:\nowamagic.sql

Second, export
Mysql>source/root/test.sql



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

CentOS MySQL Database Export Import

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.