mysql怎么创建表空间

来自:互联网
时间:2020-09-29
阅读:
免费资源网 - https://freexyz.cn/

创建表空间

sql语句:

MySQL> create tablespace big_data_in_mysql add datafile 'first.ibd';
Query OK, 0 rows affected (0.57 sec)

上面这个语句就会创建一个名为big_data_in_mysql的表空间。同时这个表空间所对应的数据存放在first.ibd这个文件中。

因为这里没有指定存储目录,所以使用的是默认存储路径。这时,可以到默认数据存储文件夹下查看是否创建成功。

mysql怎么创建表空间

查看表空间

mysql> select * from information_schema.INNODB_SYS_TABLESPACES ;
+-------+---------------------------------+------+-------------+------------+-----------+---------------+------------+---------------+-----------+----------------+
| SPACE | NAME                            | FLAG | FILE_FORMAT | ROW_FORMAT | PAGE_SIZE | ZIP_PAGE_SIZE | SPACE_TYPE | FS_BLOCK_SIZE | FILE_SIZE | ALLOCATED_SIZE |
+-------+---------------------------------+------+-------------+------------+-----------+---------------+------------+---------------+-----------+----------------+
|     2 | mysql/plugin                    |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |     98304 |          98304 |
|     3 | mysql/servers                   |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |     98304 |          98304 |
|     4 | mysql/help_topic                |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |   9437184 |        9437184 |
····
|    93 | bas/t_bas_shop_item             |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |    163840 |         163840 |
|   119 | insidemysql/student#p#p2        |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |     98304 |          98304 |
|   120 | insidemysql/t                   |   33 | Barracuda   | Dynamic    |     16384 |             0 | Single     |         65536 |     98304 |          98304 |
|   122 | test_tablespace                 | 2048 | Any         | Any        |     16384 |             0 | General    |         65536 |     65536 |          65536 |
|   125 | big_data_in_mysql               | 2048 | Any         | Any        |     16384 |             0 | General    |         65536 |     65536 |          65536 |
+-------+---------------------------------+------+-------------+------------+-----------+---------------+------------+---------------+-----------+----------------+
53 rows in set (0.03 sec)

删除表空间

DROP TABLESPACE tablespace_name
[ENGINE [=] engine_name]
免费资源网 - https://freexyz.cn/
返回顶部
顶部