mysql 表存储位置更改

时间:2022-09-03 12:20:30

mysql> USE test;

Database changed

mysql> SHOW VARIABLES LIKE 'innodb_file_per_table';

+-----------------------+-------+

|Variable_name | Value |

+-----------------------+-------+

|innodb_file_per_table | ON |

+-----------------------+-------+

mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/alternative/directory';

# MySQL creates a .ibd file for the new table in a subdirectory that corresponding# to the database name

db_user@ubuntu:~/alternative/directory/test$ ls t1.ibd

# MySQL creates a .isl file containing the path name for the table in a directory# beneath the MySQL data directory

db_user@ubuntu:~/mysql/data/test$ ls db.opt t1.frm t1.isl