Mysql database Backup and recovery method _mysql

Source: Internet
Author: User

Shong asked me how to back up the database, here are 3 ways to back up the database:

(1) Backing Up database files

Each database and datasheet in MySQL corresponds to the directory in the file system and the files under it.
In Linux, the database files are stored in a directory generally/var/lib/mysql. Under Windows This directory depends on the installation path of MySQL, diahosting technicians are generally installed under D:serversoftmysql for customers.
For example, there is a database called BBS, then the BBS database files will be stored in/var/lib/mysql/bbs (Linux) or D:serversoftmysqlbbs (Windows).


Before backing up your files, you need to stop the MySQL service and then copy the database directory.
When you restore a data database, you need to create a database (not necessarily the same name), and then copy the backed-up files (note, not the directory) to the corresponding MySQL database directory.
When you use this method to back up and restore a database, you need to be consistent with the old and new versions of MySQL, or you may get an error.

(2) using command line tools

Back up the database:

Mysqldump–user=root–password=root password –lock-all-tables database name > backup file. sql

To recover a database:

Mysql-u root–password=root Password Database name < backup file. sql

(3) using Web programs
Here we recommend using the "Imperial Backup King" to back up MySQL.
Main advantages:
1, cross platform. Windows and Linux can be run under a variety of web environments.
2, intelligent identification Code, to solve the problem of garbled backup.
3, backup and restore operations can be performed between different versions of MySQL.
4, with a group backup, even more than 1G of the database can be normal backup.

Login "Empire Backup King"

User name: admin
Default password: 123456

The program automatically jumps to the settings page of the database the first time you log on.

For security reasons, be sure to modify the default login password.

    • Backing up a database

    • Restore Database

If you are recovering on another machine, you will need to upload the "Empire Backup King" program and the directory where the backup data resides in the Bdata directory to the new machine.

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.