MySQL specifies the data file storage path DATADIRECTORY and INDEXDIRECTORY

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.