title: MySQL permissions issue - should be non-issue
body: <p>This is making me kind of crazy:  I did a mysqldump of a partitioned table on one server, moved the resulting SQL dump to another server, and attempted to run the insert.  It fails, but I'm having difficulty figuring out why.  Google and the MySQL forums and docs have not been much help.</p>
  
  <p>The failing query looks like this (truncated for brevity and clarity, names changed to protect the innocent):</p>
  
  <pre><code>CREATE TABLE `my_precious_table` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   `somedata` varchar(20) NOT NULL,
   `aTimeStamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   PRIMARY KEY (`id`,`aTimeStamp`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/opt/data/data2/data_foo/' INDEX DIRECTORY='/opt/data/data2/idx_foo/' 
  /*!50100 PARTITION BY RANGE (year(aTimeStamp)) SUBPARTITION BY HASH ( TO_DAYS(aTimeStamp)) 
  (PARTITION p0 VALUES LESS THAN (2007) (SUBPARTITION foo0 DATA DIRECTORY = '/opt/data/data2/data_foo' INDEX DIRECTORY = '/opt/data/data2/idx_foo' ENGINE = MyISAM), 
  PARTITION p1 VALUES LESS THAN (2008) (SUBPARTITION foo1 DATA DIRECTORY = '/opt/data/data2/data_foo' INDEX DIRECTORY = '/opt/data/data2/idx_foo' ENGINE = MyISAM), 
  PARTITION p2 VALUES LESS THAN (2009) (SUBPARTITION foo2 DATA DIRECTORY = '/opt/data/data2/data_foo' INDEX DIRECTORY = '/opt/data/data2/idx_foo' ENGINE = MyISAM), 
  PARTITION p3 VALUES LESS THAN MAXVALUE (SUBPARTITION foo3 DATA DIRECTORY = '/opt/data/data2/data_foo' INDEX DIRECTORY = '/opt/data/data2/idx_foo' ENGINE = MyISAM)) */;
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>ERROR 1 (HY000): Can't create/write to file '/opt/data/data2/idx_foo/my_precious_table#P#p0#SP#foo0.MYI' (Errcode: 13)</p>
  </blockquote>
  
  <p>"Can't create/write to file" looked like a permissions issue to me, but permissions on the targeted folders look thus:</p>
  
  <pre><code>drwxrwxrwx 2 mysql mysql 4096 Dec  1 16:24 data_foo
  drwxrwxrwx 2 mysql mysql 4096 Dec  1 16:25 idx_foo
  </code></pre>
  
  <p>For kicks, I've tried chowning to root:root and myself.  This did not fix the issue.</p>
  
  <p>Source MySQL server is version 5.1.22-rc-log.  Destination server is 5.1.29-rc-community.  Both are running on recent CentOS installations.</p>
  
  <p><strong>Edit:</strong>  A little more research shows that Errcode 13 is, in fact, a permissions error.  But how can I get that on <code>rwxrwxrwx</code>?</p>
  
  <p><strong>Edit:</strong>  Bill Karwin's excellent suggestion didn't pan out.  I'm working as the root user, and have all privilege flags set.</p>
  
  <p><strong>Edit:</strong>  Creating the table WITHOUT specifying data directories for the individual partitions works - but I need to put these partitions on a larger disk than the one on which this MySQL instance puts tables by default.  And I can't just specify the DATA/INDEX DIRECTORY at the table level - that's not legit in the version of MySQL I'm using (5.1.29-rc-community).</p>
  
  <p><strong>Edit:</strong> Finally came across the answer, thanks to the MySQL mailing list and internal IT staff.  See below.</p>