Backup and restore of MySQL

Source: Internet
Author: User
Tags localhost mysql mysql backup mysql command line

backup and restore of MySQL

Category: MySQL 2008-09-18 14:54 48826 People read Comments (2) Collection Report

MySQL database databasecommandcmd

mysql Backup and restore is done using the mysqldump, MySQL, and source commands. Backup and restore of MySQL under
1.win32
1.1 Backup
Start Menu | run | cmd | Take advantage of the Cd/program files/mysql/ MySQL Server 5.0/bin "command goes to Bin folder | Export the database to a file, such as Mysqldump-u root-p voice>, using "mysqldump  -u user name-p databasename >exportfilename" Voice.sql, then enter the password to start the export.
 
1.2 Restore
Enter the MySQL command line Client, enter the password, go to "mysql>", enter the command "show databases;", enter, Look at some of the databases, build the database you want to restore, enter "CREATE database voice;", enter, switch to the newly created database, type "use voice;", carriage return; Import data, enter "source Voice.sql;", return, start import , the "mysql>" appears again and the restore succeeds without prompting the error.
 
2.Linux Backup and restore of MySQL
2.1 backup
[root@localhost ~]# cd/var/lib/ MySQL (go to MySQL library directory, adjust the directory according to your MySQL installation)
[root@localhost mysql]# mysqldump-u root-p voice>voice.sql, enter the password.

2.2 Restore
Law One:
[Root@localhost ~]# mysql-u root-p return, enter the password, enter the MySQL console "mysql>", with 1.2 restore.

Law II:
[Root@localhost ~]# Cd/var/lib/mysql (go to MySQL library directory, adjust the directory according to your MySQL installation situation)
[Root@localhost mysql]# mysql-u root-p voice<voice.sql, enter the password.

Backup and restore of MySQL

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.