Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Enable or Disable file per table

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL version: 5.7.18

1 first take a look at the tablespace storage location of table in the case of Disable.

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: only t1.frm files, no data files.

2 Let's take a look at the Enable case, let's move the watch.

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

Description: move table alter table Train.t1 engine=innodb in the case of innodb_file_per_table=1

There are more t1.ibd files in the data directory.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report