LLI Wiki — My Digital Knowledge Base

MySQL / MariaDB: find the data directory and data files

Queries to locate the data directory and tablespace files of MySQL or MariaDB.

To find where MySQL or MariaDB stores its data files, query the server variables.

SHOW VARIABLES LIKE 'datadir';
SELECT @@datadir;
SHOW VARIABLES LIKE 'innodb_data%';
SHOW VARIABLES LIKE 'innodb_file_per_table';

On MySQL, the INFORMATION_SCHEMA.FILES view lists the tablespace files:

SELECT FILE_NAME, TABLESPACE_NAME FROM INFORMATION_SCHEMA.FILES;

Source: Check data file location and tablespaces in MariaDB or MySQL.

Mastodon LLIMastodon SocialFosstodon