1120Setting Memory/Buffer Bool for MariaDB
- OS: Ubuntu
- DB: MariaDB
innodb_buffer_pool_size
defaults to 128M which might not be enought if you have a big database.
MariaDB Documentation: Configure the InnoDB Buffer Pool Size
0. Log in with root via SSH
1. Check Buffer Size
mysql
mysql>
MariaDB>SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| innodb_buffer_pool_size | 134217728 |
+-------------------------+-----------+
1 row in set (0.001 sec)
That's 128M default. 128 * 1024 * 1024
2. Add a MariaDB configuration file
cd /etc/mysql/mariadb.conf.d
ls -l
-rw-r--r-- 1 root root 575 Feb 19 00:56 50-client.cnf
-rw-r--r-- 1 root root 231 Feb 19 00:56 50-mysql-clients.cnf
-rw-r--r-- 1 root root 927 Feb 19 00:56 50-mysqld_safe.cnf
-rw-r--r-- 1 root root 3769 Feb 19 00:56 50-server.cnf
-rw-r--r-- 1 root root 570 Feb 19 00:56 60-galera.cnf
nano z-custom-mariadb.cnf
[mysqld]
innodb_buffer_pool_size=2G
3. Restart DB Server
sudo systemctl restart mariadb
Troubleshooting
Q. I updated the value, but the value is not changed on the server.
A. Check that your configuration file ends in .cnf
and not in .conf
- otherwise it won't be read.