Mysql InnoDB completely releases disk space, mysqlinnodb

Source: Internet
Author: User

Mysql InnoDB completely releases disk space, mysqlinnodb

The Innodb database only marks deleted data and does not actually release the occupied disk space, which leads to the increasing number of InnoDB database files.

To completely release the disk space, export the data first, delete the data file, and import the data. The procedure is as follows:

Backup database batch processing command:

.. \ Bin \ mysqldump-uroot-proot-P3306-h127.0.0.1 -- default-character-set = gb2312 Database Name> database backup. SQL

Restore database batch processing command:

.. \ Bin \ mysql-uroot-proot-P3306-h127.0.0.1 -- default-character-set = gb2312 <database backup. SQL

Echo. & pause (add this sentence to see the batch processing execution result)

If the error "No database selected" is reported during data import, you must add the "use database Name" before mysqldump. SQL script ;"


How to release deleted InnoDB disk space

If you want to completely release the deleted data, you need to export the database, delete the InnoDB database file, and then import it. The basic steps are as follows: 1. Use the mysqldump command to export the InnoDB database 2. Stop MySQL3. Delete All InnoDB database files and logs 4. Start MySQL and automatically recreate InnoDB database files and log files 5. Import the database files backed up earlier. Note that, you have configured MySQL database replication. When you import the database backup file, all queries may be written to Binlog. You can run SET SQL _LOG_BIN = 0. You can temporarily stop writing Binlog.

Mysql innodb files are of the same length. How can we reduce the file size when the delete statement deletes data?

The primary space of mysql innodb can only be increased and cannot be reduced. However, after a table is deleted, the space occupied by the table in this space will be released, but the file size will not be reduced.

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.