MySQL database backup and recovery method _ MySQL

Source: Internet
Author: User
MySQL database backup and recovery methods, website data is the most valuable for our webmaster, we should develop a good habit of backing up data at ordinary times. BitsCN.com

A beginner often asks me how to back up the database. The following describes three methods to back up the database:

(1) back up database files

Each database and data table in MySQL correspond to the directory in the file system and the files under it.
In Linux, the directory where database files are stored is/var/lib/mysql. In Windows, this directory depends on the MySQL installation path. the DiaHosting technician is generally installed in D: serversoftmysql for the customer.
For example, a database named bbs is stored in/var/lib/mysql/bbs (linux) or D: serversoftmysqlbbs (Windows.


Before backing up a file, you mustStop MySQL serviceAnd then copy the Database Directory.
When restoring the data database, you must first create a database (not necessarily with the same name), and then copy the backup files (note, not the directory) to the corresponding MySQL database directory.
When using this method to back up and restore the database, the old and new MySQL versions must be consistent. Otherwise, an error may occur.

(2) use the command line tool

Back up the database:

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

Restore database:

Mysql-u root-password = root password database name <backup file. SQL

(3) Use Web programs
We recommend that you back up MySQL using the "Empire backup King.
Main advantages:
1. cross-platform. Windows and Linux can run in various WEB environments.
2. intelligently identifies the encoding to solve the garbled data during backup.
3. backup and recovery can be performed between different MySQL versions.
4. back up data by group. Even databases that exceed 1 GB can be backed up normally.

Log on to "Empire backup King"

Username: admin
Default password 123456

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

To ensure security, you must change the default logon password.

  • Back up Database

  • Restore database

If it is restored on another machine, you need to upload the "Empire backup King" program and the directory under the bdata directory that stores the backup data to the new machine.

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.