Where Is the MariaDB Data Directory?
MariaDB data lives wherever datadir points. The Linux and Windows defaults and the option files behind them.
Last updated
MariaDB stores databases wherever the datadir setting points. On Linux package installs that defaults to /var/lib/mysql, a compiled in fallback when no config sets it. Debian style systems pin it in /etc/mysql/mariadb.conf.d/50-server.cnf; check that file before trusting folklore.
Windows MSI installs default to a data folder under the install root, usually C:\Program Files\MariaDB <version>\data. The my.ini search order on Windows spans several spots including the install dir, so run a quick search for datadir across them when the service refuses to start.
Where MariaDB stores this, by platform
/var/lib/mysql
Compiled default and distro config value. The mysql user must own it. Stop the server before copying it elsewhere, then update datadir in the server cnf and fix ownership.
C:\Program Files\MariaDB\data
Default DATADIR is INSTALLDIR\data with the version in the real path. my.ini may live in the data dir itself or the install dir. The installer offers a Database directory shortcut to open it.
Frequently asked questions
how do i find my live mariadb datadir
Query the running server with SHOW VARIABLES LIKE 'datadir', or read the datadir line in the active my.cnf or my.ini. The compiled default only applies when no option file sets it, so the config wins.
can i just copy var lib mysql for a backup
Only with the server stopped and ownership preserved. InnoDB files plus logs must move as a set. For live backups use mariadb-dump or mariabackup instead of file copies.
Notice an outdated path? Let us know.