Skip to Content
MySQL 8 Cookbook
book

MySQL 8 Cookbook

by Karthik Appigatla
January 2018
Intermediate to advanced
446 pages
12h 57m
English
Packt Publishing
Content preview from MySQL 8 Cookbook

Adding tables to a general tablespace

You can add a table to a tablespace while creating it, or you can run the ALTER command to move a table from one tablespace to another:

mysql> CREATE TABLE employees.table_gen_ts1 (id INT PRIMARY KEY) TABLESPACE ts1;Query OK, 0 rows affected (0.01 sec)

Suppose you want to move the employees table to TABLESPACE ts2:

mysql> USE employees;Database changedmysql> ALTER TABLE employees TABLESPACE ts2;Query OK, 0 rows affected (3.93 sec)Records: 0  Duplicates: 0  Warnings: 0

You can notice the increase in the ts2.ibd file:

shell> sudo ls -lhtr /var/lib/mysql_general_ts/ts2.ibd-rw-r-----. 1 mysql mysql 32M Oct  8 17:07 /var/lib/mysql_general_ts/ts2.ibd
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MySQL Cookbook

MySQL Cookbook

Paul DuBois
Advanced MySQL 8

Advanced MySQL 8

Eric Vanier, Birju Shah, Tejaswi Malepati

Publisher Resources

ISBN: 9781788395809Other