1.查看当前的表空间:
[mysql@master ~]$ mysql -uroot -hlocalhost
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 55
Server version: 5.6.16-log Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show variables like 'innodb_data%';
+-----------------------+------------------------+
| Variable_name | Value |
+-----------------------+------------------------+
| innodb_data_file_path | ibdata1:12M:autoextend |
| innodb_data_home_dir | |
+-----------------------+------------------------+
2 rows in set (0.07 sec)
[mysql@master data]$ ls -ltrh ibdata1
-rw-rw----. 1 mysql mysql 460M Mar 14 13:47 ibdata1
2.
mysql> show variables like '%per_table%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| innodb_file_per_table | ON |
+-----------------------+-------+
1 row in set (0.06 sec)
说明:OFF代表mysql是共享表空间,也就是所有库的数据都存放在一个ibdate1文件中
独享表空间存储方式使用“.ibd”文件来存放数据,且每个表一个“.ibd”文件,文件存放在和MyISAM 数据相同的位置,由datadir确定。如果选用共享存储表空间来存放数据,则会使用ibdata 文件来
存放,所有表共同使用一个(或者多个,可自行配置)ibdata 文件。ibdata 文件可以通过innodb_data_home_dir 和innodb_data_file_path