CentOS MySQL Database Export and Import, centosmysql

Source: Internet
Author: User
Tags wordpress database

CentOS MySQL Database Export and Import, centosmysql

You can use the database backup tool mysqldump to import and export mysql databases.

Mysqldump is a handy tool that comes with mysql. the/usr/local/mysql/bin (CentOS) Directory of mysql installation directory is under.

Like mysql, mysqldump is an application and cannot be executed in mysql. Remember to enter mysqldump-help to check the annual information. Mysqldump can be executed directly in any directory.

1. Export

Back up a database with mysqldump
1 Mysqldump-u user-p Password Database Name> (directory) Export File Name

For example, mysqldump-uroot-p123 dbname>/root/test. SQL, press enter to complete the backup.

If you only need the table creation command, the command is as follows: shell> mysqldump-u root-p-d dbname> test. SQL

If you only need to insert the SQL command of data without the table creation command, the command is as follows: shell> mysqldump-u root-p-t dbname> test. SQL

Back up a single data table

Sometimes the database is very large, and the entire database backup is difficult to manage, so it is a separate backup.

1 mysqldump -uroot -p123 dbname tablename >  /root/testtb.sql
Back 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

Ii. Export
mysql>source /root/test.sql



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.