MySQL specifies the data file storage path DATADIRECTORY and INDEXDIRECTORY
MySQL specifies the DATA file storage path data directory And INDEX DIRECTORY
Operating Environment: CentOS 6.4 64-bit
First, create the/ibddir directory and modify the owner of the/ibddir directory and the corresponding group: chown-R mysql: mysql/ibddir
Operation 1:
Create table 'd _ TF_DATA_AGGREGATION_MYISAM '(
'Strative _ id' VARCHAR (16) not null,
'Date _ id' VARCHAR (8) not null,
'Qua _ id' VARCHAR (4) not null,
'Fh 'DECIMAL () default null,
'Dl 'DECIMAL (16, 6) default null,
Primary key ('strative _ id', 'date _ id', 'qua _ id ')
) ENGINE = myisam data directory = '/ibddir' index directory ='/ibddir ';
Create table 'd _ TF_DATA_AGGREGATION '(
'Strative _ id' VARCHAR (16) not null,
'Date _ id' VARCHAR (8) not null,
'Qua _ id' VARCHAR (4) not null,
'Fh 'DECIMAL () default null,
'Dl 'DECIMAL (16, 6) default null,
Primary key ('strative _ id', 'date _ id', 'qua _ id ')
) ENGINE = innodb data directory = '/ibddir'
Operation 2:
Create table 'd _ TF_DATA_AGGREGATION_1 '(
'Strative _ id' VARCHAR (16) not null,
'Date _ id' VARCHAR (8) not null,
'Qua _ id' VARCHAR (4) not null,
'Fh 'DECIMAL () default null,
'Dl 'DECIMAL (16, 6) default null,
Primary key ('strative _ id', 'date _ id', 'qua _ id ')
) ENGINE = MYISAM;
Alter table D_TF_DATA_AGGREGATION_1 data directory = '/ibddir ';
Alter table D_TF_DATA_AGGREGATION_1 index directory = '/ibddir ';
Show warnings;
-- Alter operation -- Option ignored
-- Alter operation -- Option ignored
-- It can be seen that the specified data directory And index directory operations can only be specified when the TABLE is created, but not alter (alter table ignores the data directory And index directory table options ).
Note: You can specify the index directory And data directory operations. When the disk partition is insufficient, you can place the DATA files on other partitions.
Note: INNODB tables are independent tablespaces (innodb_file_per_table = 1 ).
Note: currently, only 5.6 supports specifying a directory for a single table, and the directory is mysql: mysql.
Note: The data directory and index directory options are ignored in Windows.