This section describes what you can do when your
InnoDB
system tablespace
runs out of room or when you want to change the size of the
redo log files.
The easiest way to increase the size of the
InnoDB system tablespace is to configure it
from the beginning to be auto-extending. Specify the
autoextend attribute for the last data file
in the tablespace definition. Then InnoDB
increases the size of that file automatically in 8MB increments
when it runs out of space. The increment size can be changed by
setting the value of the
innodb_autoextend_increment
system variable, which is measured in megabytes.
You can expand the system tablespace by a defined amount by adding another data file:
Shut down the MySQL server.
If the previous last data file is defined with the keyword
autoextend, change its definition to use
a fixed size, based on how large it has actually grown.
Check the size of the data file, round it down to the
closest multiple of 1024 × 1024 bytes (= 1MB),
and specify this rounded size explicitly in
innodb_data_file_path.
Add a new data file to the end of
innodb_data_file_path,
optionally making that file auto-extending. Only the last
data file in the
innodb_data_file_path can
be specified as auto-extending.
Start the MySQL server again.
For example, this tablespace has just one auto-extending data
file ibdata1:
innodb_data_home_dir = innodb_data_file_path = /ibdata/ibdata1:10M:autoextend
Suppose that this data file, over time, has grown to 988MB. Here is the configuration line after modifying the original data file to use a fixed size and adding a new auto-extending data file:
innodb_data_home_dir = innodb_data_file_path = /ibdata/ibdata1:988M;/disk2/ibdata2:50M:autoextend
When you add a new data file to the system tablespace
configuration, make sure that the filename does not refer to an
existing file. InnoDB creates and initializes
the file when you restart the server.
Currently, you cannot remove a data file from the system tablespace. To decrease the system tablespace size, use this procedure:
Use mysqldump to dump all your
InnoDB tables.
Stop the server.
Remove all the existing tablespace files, including the
ibdata and ib_log
files. If you want to keep a backup copy of the information,
then copy all the ib* files to another
location before the removing the files in your MySQL
installation.
Remove any .frm files for
InnoDB tables.
Configure a new tablespace.
Restart the server.
Import the dump files.
If you want to change the number or the size of your
InnoDB log files, use the following
instructions. The procedure to use depends on the value of
innodb_fast_shutdown, which
determines whether or not to bring the system tablespace fully
up-to-date before a shutdown operation:
If innodb_fast_shutdown is
not set to 2: Stop the MySQL server and make sure that it
shuts down without errors, to ensure that there is no
information for outstanding transactions in the redo log.
Copy the old redo log files to a safe place, in case
something went wrong during the shutdown and you need them
to recover the tablespace. Delete the old log files from the
log file directory, edit my.cnf to
change the log file configuration, and start the MySQL
server again. mysqld sees that no
InnoDB log files exist at startup and
creates new ones.
If innodb_fast_shutdown is
set to 2: Set
innodb_fast_shutdown to 1:
mysql> SET GLOBAL innodb_fast_shutdown = 1;
Then follow the instructions in the previous item.

User Comments
It is absurd that there is not a builtin function to compact the ibdata file to reclaim unused space to the OS. *ALWAYS* use innodb_file_per_table.
Shouldn't the innodb_fast_shutdown value set to 0 be the one that's advised before changing innodb logs ?
Since it does full insert buffer merge before shutting down it would be safer way to change innodb_log_file_size and/or innodb_log_files_in_group, am I wrong ?
Add your own comment.