Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to change the innodb_log_file_size setting in MySQL/MariaDB?
Answer
- Connect to your Plesk server via SSH.
- Open the MySQL/MariaDB configuration file
my.cnfin a text editor. In this example, we are using vi editor:-
on CentOS/RHEL-based distributions:
# vi /etc/my.cnf
-
on Debian/Ubuntu-based distributions:
# vi /etc/mysql/my.cnf
-
-
Under the
[mysqld]section, change theinnodb_log_file_sizevalue according to your needs (the default value is 48M):Note: If the
innodb_log_file_sizedirective does not exist in the file, add it manually under the[mysqld]section.CONFIG_TEXT: [mysqld]
innodb_log_file_size=128M
<...> - Save the changes and close the file.
-
Find MariaDB version:
# mysql -V
If MariaDB version is 10.5 or higher, move to step 6. If MariaDB version is 10.4 or lower, apply these additional steps:
5.1. Stop the MySQL/MariaDB service:
# systemctl stop mariadb && systemctl stop mysql
5.2. Move the redo log files
ib_logfile0andib_logfile1to another directory. In this example, the files are moved to/root:# mv /var/lib/mysql/ib_log* /root
-
Restart the MySQL/MariaDB service:
# systemctl start mariadb && systemctl start mysql
In Plesk for Windows, there are two MariaDB instances with their own configuration:
-
Plesk SQL server for Plesk system databases (location
%plesk_dir%MySQL\) -
MariaDB (or MySQL) for customers' databases (location
%plesk_dir%Databases\MySQL\)
- Connect to your Plesk server via RDP.
-
Open MariaDB configuration file
my.iniin a text editor (paste the path below in Windows Explorer to open):C:\> %plesk_dir%MySQL\my.ini
-
Under the
[mysqld]section, change theinnodb_log_file_sizevalue according to your needs (the default value is 10M):CONFIG_TEXT: innodb_log_file_size=128M
- Save the changes and close the file.
- Restart the Plesk SQL Server service via Plesk Services Monitor or Windows Services.
- Connect to your Plesk server via RDP.
-
Open MariaDB configuration file
my.iniin a text editor (paste the path below in Windows Explorer to open):C:\> %plesk_dir%Databases\MySQL\my.ini
-
Under the
[mysqld]section, change theinnodb_log_file_sizevalue according to your needs (the default value is 10M):CONFIG_TEXT: innodb_log_file_size=128M
- Save the changes and close the file.
- Restart the MariaDB service via Plesk Services Monitor or Windows Services.
Comments
These instructions work on MariaDB 10.3 but on 10.11.6 - if you do step #5 (moving ib_log*) then mariadb will not start:
If you skip step #5, and just restart the service, it will re-size the existing file: (96MB->32MB in my case)
This may be correlated with: "innodb_log_file_size: From MariaDB 10.9 the variable is dynamic, and the server no longer needs to be restarted for the resizing to take place."
It also corresponds to https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-redo-log
Directly editing or moving the redo logs can cause corruption, and should never normally be attempted.
Please update the instructions with specific note that not to move ib_logfile0 on 10.11+.
10.5 requires https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-system-variables#innodb_log_file_size of 0 or 3.
For measuring what it should be, take a look though https://mariadb.com/docs/server/server-usage/storage-engines/innodb/innodb-redo-log#determining-the-redo-log-occupancy
Also note “
ib_logfile0andib_logfile1” from 10.5 there is only a single log file.Please sign in to leave a comment.