InnoDB Chinese Reference manual---5 adding and removing InnoDB data and log files

Source: Internet
Author: User
Tags manual log mysql reference mysql database
Reference | Reference Manual | data | Chinese InnoDB Chinese reference Manual---Dog dog (heart sail) Translation 5 Add and remove InnoDB data and log files
To add a data file to the tablespace, first close the MySQL database, edit the my.cnf file, add a new file to the Innodb_data_file_path, and then restart the service.

If the last file is described as a keyword autoextend, the process of editing the MY.CNF is shown below. You must check the size of the last file and close it to a multiple of 1024 * 1024 bytes (= 1 MB) and specify its dimensions explicitly in Innodb_data_file_path. Then you can add another data file. Remember that only the last file in Innodb_data_file_path can be specified as auto-extending.

One example: Assuming that at first there was only one auto-extending data file ibdata1, the closer the file was to 988 MB. The following is a possible example after adding another auto-extending data file.
Innodb_data_home_dir =innodb_data_file_path =/ibdata/ibdata1:988m;/disk2/ibdata2:50m:autoextend



InnoDB data files are usually not removed. To reduce the size of the data file, you must use mysqldump to dump all of the data tables, re-establish a new database, and import the data into the new database.

If you want to change the number of InnoDB log files, you must first turn off MySQL and make sure that it is completely closed without any errors. Copy the old log files to another secure location in case you have an error shutting down the service and need to recover the database. Delete all log files, edit my.cnf, and then restart MySQL. InnoDB will prompt it to create a new log file at startup.


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.