Skip to content

MariaDB 11.8 configuration that matters on Debian 13

MariaDB 11.8 changes three settings that matter on a real server: the InnoDB buffer pool starts at 128 MiB, new text columns take a collation older tables do not share, and the slow query log is off. Here is what each one does and how to set it on Debian 13.

Three settings decide how a MariaDB server behaves under load. They are the size of the InnoDB buffer pool, the collation new text columns get, and whether the slow query log records anything at all. MariaDB 11.8 ships a pool that is too small for a database of any serious size. It hands new columns a collation that changed a few releases ago. And it leaves the slow query log switched off.

I installed MariaDB 11.8.9 on Debian 13 from the distribution’s own packages. Each value below is what that server reported.

Where the settings go

Debian keeps MariaDB’s configuration in /etc/mysql/. The file my.cnf is a symlink chain that ends at mariadb.cnf. That file in turn pulls in every .cnf under /etc/mysql/conf.d/ and /etc/mysql/mariadb.conf.d/.

MariaDB reads those files in name order. A setting in a later file overrides the same setting in an earlier one. Giving a setting twice is not an error; the last one wins.

The package’s own files live in mariadb.conf.d/ with numbered names. Leave them alone and add your own beside them. A common choice is /etc/mysql/mariadb.conf.d/99-tuning.cnf. MariaDB reads it at the next start, and a package upgrade leaves it in place.

The section name inside the file decides who reads the setting. [mariadbd] holds options for the server alone. [client] holds options for the command-line clients. Put a setting under the wrong section and the program that should have read it ignores it.

To see the options a client will actually use, before it connects to anything:

On this Debian 13 install the socket path in that output comes from mariadb.cnf, and the --skip-ssl beside it comes from the account’s own ~/.my.cnf rather than from the package. That is the reason to ask the client for its defaults instead of reading one file: the answer is the package files plus whatever your own home directory adds. With --skip-ssl in force, the local client connects without negotiating TLS, even against a server set up for it.

Check one shipped setting before you connect from another host. 50-server.cnf sets bind-address = 127.0.0.1. A new install therefore listens on the loopback interface only. Put the server’s own address, or 0.0.0.0, in your own file to accept connections from elsewhere.

The InnoDB buffer pool

InnoDB keeps tables and indexes in memory in the buffer pool. The number that matters most for performance is innodb_buffer_pool_size. MariaDB 11.8 gives it 128 MiB by default, whatever the machine holds:

When the working set is larger than the pool, InnoDB reads pages from disk that it should already hold. How much to give the pool depends on the rest of the machine. On a server whose main job is the database, a common starting point is around 70 percent of RAM. That leaves room for the operating system and the per-connection buffers. On a 16 GiB machine the result sits far above the default:

Put the value in your own file under [mariadbd]. MariaDB allocates the pool as it starts. Read the variable back after a restart, or look in the error log. InnoDB prints the size it opened the pool with, and with the default still in place that line reads:

I added 512M to the file and restarted. The read-back then printed 512.00000000, so the file is what the server obeys.

You can also change the size without a restart. MariaDB resizes the pool while it runs and writes the change to the error log:

A runtime change like that one does not survive a restart. Put the value in the configuration file too and use the runtime command to test a size before you commit to it.

Checking whether the pool is large enough

Two status counters answer that question. Innodb_buffer_pool_read_requests counts how often InnoDB asked the pool for a page. Innodb_buffer_pool_reads counts how often the page was missing and came from disk instead. Their ratio is the miss rate:

Right after a restart both counters sit near zero and the ratio means nothing. Let the server work first. I built a three-thousand-row table and joined it to itself a few times. The counters then stood at 54288 requests against 238 reads, a miss rate of 0.438403 percent. A rate that stays low over a day of traffic says the pool holds the working set. A rate that climbs says it does not.

New text columns no longer use utf8mb4_general_ci

This change is the one most likely to catch you out on an upgrade. For years MariaDB defaulted to the latin1 character set and the latin1_swedish_ci collation. MariaDB 11.6 replaced both, and 11.8 is the first long-term-support release to carry the change. A server that jumped from 10.6 or 11.4 therefore gets both new defaults at once:

The collation is the surprising part. A table created with no character-set clause in a utf8mb4 database now comes out as utf8mb4_uca1400_ai_ci. The same statement once produced utf8mb4_general_ci. The two are not interchangeable, and a join across them stops with an error.

One database, two collations

MariaDB 11.5 added a system variable, character_set_collations. It maps each character set to the collation a statement uses when that statement names the set without naming a collation. On 11.8 the map comes filled in. One database can therefore hold two text columns built by two statements that look equivalent:

Say the database’s default collation is utf8mb4_general_ci. The first column then comes out general_ci and the second comes out uca1400_ai_ci. The table listing hides the difference. information_schema.tables reports utf8mb4_general_ci for both, because the table inherits its collation from the database. The column itself carries the map’s collation. SHOW CREATE TABLE prints both, with the column’s own COLLATE beside the table’s:

Because the two columns disagree, a join across them fails:

To keep the older collation for new tables, set the map back in your own file:

After a restart a database created with CHARACTER SET utf8mb4 reported utf8mb4_general_ci, and so did both tables above. Do this only when something needs the old comparison rules, such as a replica on an older MariaDB. The new collation handles supplementary characters and expansions better.

Turning on the slow query log

A slow query log that is off records nothing. MariaDB 11.8 leaves it off:

By default MariaDB writes a query to the log only when it runs longer than ten seconds. The log file takes the server’s own hostname plus -slow.log and sits in the data directory. Two commands change both for the life of the running server:

Those settings do not survive a restart, so put them in your own file under [mariadbd]:

MariaDB accepts two spellings of each of these settings: the older MySQL-compatible names, slow_query_log, long_query_time and slow_query_log_file, and the newer MariaDB names, log_slow_query, log_slow_query_time and log_slow_query_file. The two sets are the same settings under two names: the file above set slow_query_log and long_query_time, and the server reports log_slow_query as ON and log_slow_query_time as 1. Debian’s shipped 50-server.cnf uses the newer names in its commented sample, so meeting them there is not a mistake:

If you point the log at /var/log/mysql/, create that directory and give it to the mysql user first. MariaDB will not start with a log file it cannot write.

What a slow entry contains

Each entry opens with the query time, the rows examined and the timestamp, then the statement itself. That alone often finds the query. For more detail, the slow log accepts a log_slow_verbosity setting. Its useful tokens do different things. Setting query_plan appends the scan flags:

The explain token adds the plan itself, printed into the same entry. Both tokens together turned a plain count into an entry that carried its own plan:

That output names the tables, the access type and the row estimates, all inside the log. It is the fastest way to see which query scans a table once the log is running.

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.