MySQL Tablespace
Theories - InnoDB Tablespace general knowledge
InnoDB tablespaces store data, metadata, buffered data, and logs on the file system.
Example 1 :
mysql> show variables where variable_name='innodb_data_file_path';
+-----------------------+------------------------+
| Variable_name | Value |
+-----------------------+------------------------+
| innodb_data_file_path | ibdata1:12M:autoextend |
+-----------------------+------------------------+
Indicates that one file called ibdata1, 12MB in size, and autoextending
Example 2 :
ibdata1:20M;/ext/ibdata2:10M:autoextend
Indicates that there are two files,
ibdata1 fixed at 20M and ibdata2 in /ext directory, 10MB, autoextending
2) Undo tablespaces
3) Temporary table tablespaces
mysql> show variables where variable_name='innodb_temp_data_file_path';
+----------------------------+-----------------------+
| Variable_name | Value |
+----------------------------+-----------------------+
| innodb_temp_data_file_path | ibtmp1:12M:autoextend |
+----------------------------+-----------------------+
Tablespace related configurations :
MySQL InnoDB Configuration:
## DATA STORAGE ##
datadir=/var/lib/mysql
## InnoDB Configuration ##
innodb_file_per_table=1
# InnoDB Memory
innodb_buffer_pool_size = 2000M
# System Tablespace configuration
innodb_data_file_path= ibdata1:512M;ibdata2:512M:autoextend
# Redo log and buffer configuration
innodb-log-files-in-group=3
innodb_log_file_size=100M
innodb_log_buffer_size=30M
#InnoDB file format
innodb_file_format = Barracuda
# UNDO Tablespace Configuration
innodb_undo_directory = /var/lib/mysql/
innodb_undo_tablespaces = 3
innodb_undo_logs = 128
innodb_undo_log_truncate = ON
innodb_rollback_segments = 128
# Temp Tablespace Configuration
tmpdir = /var/lib/mysql/
innodb_temp_data_file_path = ibtmp1:20M:autoextend
# Keyring configuration
early-plugin-load=keyring_file.so
keyring_file_data=/var/lib/mysql-keyring/keyring
Tablespace Physical datafiles
Check datadirectory
mysql> show variables where variable_name='datadir';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| datadir | /var/lib/mysql/ |
+---------------+-----------------+
root@okprd5328:/var/lib/mysql# ls
auto.cnf ibdata1 my.cnf private_key.pem
ca-key.pem ib_logfile0 mysql public_key.pem
ca.pem ib_logfile1 mysqld scripts
client-cert.pem ibtmp1 mysql.sock server-cert.pem
client-key.pem IGNITE mysql.sock.lock server-key.pem
conts_data1.ibd itun_rest okptun5 sys
ib_buffer_pool log performance_schema
Database directories : mysql, performance_schema, sys
System tablespace : ibdata1
Temporary tablespace : ibtmp1
InnoDB redo logs: ib_logfile0, iblogfile1