mysql怎么创建表空间(在Mysql中-编程知识网

创建表空间

(推荐教程:mysql教程)

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中-编程知识网

查看表空间

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]

登录后复制

相关推荐:php培训

以上就是mysql怎么创建表空间的详细内容,更多请关注风君子博客其它相关文章!