MySQL Study Notes 7-data backup and restoration _ MySQL

Source: Internet
Author: User
Tags mysql commands
MySQL Study Notes 7-data backup and restoration bitsCN.com

Back up a database using the mysqldump command

Basic syntax: mysqldump-u username-p dbname table1 table2...> BackupName. SQL back up multiple databases

Syntax: mysqldump-u username-p -- databases dbname1 dbname2> bankupName. SQL back up all databases

Mysqldump-u username-p -- all-databases> BackupName. SQL directly copies the entire database Directory. using mysqlhotcopy to quickly back up mysqlhotcopy is a Perl script, mainly used in Linux operating systems. The mysqlhotcopy tool is not provided by MySQL. you need to install the Perl data interface package. Restore data using mysql commands

Mysql-u-root-p [dbname]

Make sure that the version numbers of the two MySQL databases are the same.

This method is also used to restore the database backed up by the mysqlhotcopy command. For data migration between databases of the same MySQL version, data migration tables are of the MyISAM type. you can directly copy the Database Directory to migrate the database. Use the mysqlhotcopy command to back up the database, and then use the mysql command to restore the backup file to the new MySQL database. Export and import the SELECT [column name] from table [WHERE statement] of the OP TABLE

Into outfile 'Destination file' [OPTION]; use the mysqldump command to export a text file

Mysqldump-u root-pPassword-T target directory dbname table [option]; use mysql command to export text files

Mysql-u root-pPassword-e "SELLECT statement" dbname> D:/name.txt;

BitsCN.com

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.