show variables like %innodb_file_per_table% ;+..."/>
您好,登錄后才能下訂單哦!
MySQL 版本: 5.7.18
1 首先看一下Disable情況下,table 的tablespace存放位置。
mysql> show variables like '%innodb_file_per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | ON |
+-----------------------+-------+
1 row in set (0.00 sec)
mysql> set global innodb_file_per_table=0;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%innodb_file_per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | OFF |
+-----------------------+-------+
1 row in set (0.00 sec)
mysql> create table Train.t1 as select * from mysql.user;
ls -l
total 184
-rw-r-----. 1 mysql mysql 65 Jun 13 17:30 db.opt
-rw-r-----. 1 mysql mysql 10816 Jun 14 18:40 t1.frm
-rw-r-----. 1 mysql mysql 17702 Jun 13 17:31 tables.frm
-rw-r-----. 1 mysql mysql 147456 Jun 13 17:31 tables.ibd
note: 只有t1.frm文件,沒(méi)有數(shù)據(jù)文件。
2 再來(lái)我們看一下Enable情況下,我們移動(dòng)一下表。
mysql> show variables like '%innodb_file_per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | OFF |
+-----------------------+-------+
1 row in set (0.00 sec)
mysql> set global innodb_file_per_table=1;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%innodb_file_per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | ON |
+-----------------------+-------+
1 row in set (0.00 sec)
mysql> alter table Train.t1 engine=innodb;
Query OK, 0 rows affected (0.18 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> exit
Bye
ls -l
total 280
-rw-r-----. 1 mysql mysql 65 Jun 13 17:30 db.opt
-rw-r-----. 1 mysql mysql 10816 Jun 14 19:21 t1.frm
-rw-r-----. 1 mysql mysql 98304 Jun 14 19:21 t1.ibd
-rw-r-----. 1 mysql mysql 17702 Jun 13 17:31 tables.frm
-rw-r-----. 1 mysql mysql 147456 Jun 13 17:31 tables.ibd
note: innodb_file_per_table=1;
說(shuō)明: innodb_file_per_table=1 情況下移動(dòng)表 alter table Train.t1 engine=innodb
data 目錄下多了 t1.ibd 文件。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。