Drupal MySQL InnoDB database backup and restore instance tutorial

Source: Internet
Author: User
Tags drupal mysql command line

First of all, why do this because I work on a large Drupal project, the database files are large, and each new feature is developed on the branch, which means I need to build multiple local environments and often need to delete old branches and create new branches.

Since the database uses most of the InnoDB engine, and InnoDB is not released after the space is allocated, it can not be reused (this may be the way I haven't found the right method), so because of my frequent database creation and deletion, InnoDB's database files are getting bigger and larger. So decided to give the database file thin body.

The InnoDB database file defaults to the public ibdata1, which has reached 17G in my locality and is still getting bigger.

Below is the slimming step, pay attention to the original IBDATA1 files before the backup.

1, delete unwanted databases from the command line or phpMyAdmin.

2, back up all the databases:

Mysqldump-udbuser-ppassword--quick--force--routines--add-drop-database--all-databases--add-drop-table >/your _backup_place/mysqldump.sql

This is mainly to look at the following optional parameters, this operation is a backup of all the database, if the local database more, it will be slow. Of course, when the import will be more slow, I was in order to save space for it, if you have the same ideas as me, the use of this article's program consequences.

3, delete the Ibdata1 file, the import will be automatically established. The rest of the database is not a pipe, because the import will be deleted before the build.

4, enter the MySQL command line to import using the source command.

In the end, whether or not everyone succeeds, I am successful anyway. :)

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.