MySQL optimized ibdata1 size

Source: Internet
Author: User

In the MySQL database, if you do not specify the innodb_file_per_table parameter to separate the data for each table, the MySQL data will be stored in the Ibdata1 file.
MySQL ibdata1 storage data, indexes, etc., is the most important data source of MySQL.

As data grows, ibdata1 stores more and more data, and the corresponding volume becomes larger. And depressed, when you delete some data, the volume of ibdata1 is not reduced. Wasted disk space, affecting the I/O performance of the disk.

Here's how to reduce the volume of ibdata1

1. Backing Up the database

No matter what changes are made, it is always a good habit to back up first.

Suppose I have a database ' leon_database '

- - - > / Backup path /Leon_database.sql

2. Delete Database

Drop table leon_database;

3. Delete ibdata1 files and ib_logfile* files

4, create a new database leon_database, and import the backup good/backup path/leon_database.sql

- - < / Backup path /leon_database.sql;

4.5. If you want to use a stand-alone table space, you can add a row in MY.CNF (the path is generally/etc/my.cnf), or skip this step if you don't want to.

= 1 #1表示开启, 0 indicates off

5. Restart the MySQL service.

Service mysqld Restart

MySQL optimized ibdata1 size

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.