2016-01-11 88 views
0

我正在尝试使用DATA DIRECTORY命令创建一个新的InnoDB表,将该.ibd文件放在另一个驱动器上。我在CentOS上使用Percona MySQL 5.6.27,并且启用了innodb_file_per_table。下面是我运行命令:MySQL抛出“操作系统错误号22” - 发生了什么?

CREATE TABLE `xxx` (
`log_id` bigint(20) NOT NULL AUTO_INCREMENT, 
`campaign_id` int(11) NOT NULL, 
`subscriber_id` int(11) NOT NULL, 
`message` text, 
`processed` enum('yes','no') NOT NULL DEFAULT 'no', 
`retries` int(1) NOT NULL DEFAULT '0', 
`max_retries` int(1) NOT NULL DEFAULT '3', 
`email_message_id` varchar(255) DEFAULT NULL, 
`status` char(15) NOT NULL DEFAULT 'success', 
`date_added` datetime NOT NULL, 
PRIMARY KEY (`log_id`), 
KEY `fk_campaign_delivery_log_archive_list_subscriber1_idx` (`subscriber_id`), 
KEY `fk_campaign_delivery_log_archive_campaign1_idx` (`campaign_id`), 
KEY `sub_proc_status` (`subscriber_id`,`processed`,`status`), 
KEY `email_message_id` (`email_message_id`) 
) ENGINE=InnoDB AUTO_INCREMENT=150095504 DEFAULT CHARSET=utf8 DATA DIRECTORY='/mysql/archive/' 

这将引发在phpMyAdmin一个#1030 - Got error -1 from storage engine。看着MySQL错误日志,这是错误:

InnoDB: Error: Write to file ./abc/xxx.isl failed at offset 0. 
InnoDB: 62 bytes should have been written, only 0 were written. 
InnoDB: Operating system error number 22. 
InnoDB: Check that your OS and file system support files of this size. 
InnoDB: Check also that the disk is not full or a disk quota exceeded. 
InnoDB: Error number 22 means 'Invalid argument'. 
InnoDB: Some operating system error numbers are described at 
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html 

我测试了CREATE TABLE代码,而不DATA DIRECTORY并能正常工作。

我已经完成chown/mysql/archive并将其设置为mysql:mysql,因此mysql有权访问该文件夹。我也确认/mysql/archive有足够的空间。

我试着编辑/etc/my.cnf并设置innodb_use_native_aio = 0但这没有帮助。

有什么建议吗?

谢谢!

+0

你为什么要将'AUTO_INCREMENT'设置得这么高? – wogsland

+0

不确定。这就是'SHOW CREATE TABLE'输出的内容。我试图复制一个现有的表结构。这是我的问题吗? – user4951834

+0

更改'AUTO_INCREMENT'没有帮助 – user4951834

回答

相关问题