title: Moving MySQL InnoDB database to separate drive
body: <p>In my MySQL installation I have one InnoDB database that I know will grow very large so I have decided to move it to its own disk. I was hoping to do this by moving the files to the other disk and then create a symlink but I run into errors!</p>
  
  <p>This is what I have done:</p>
  
  <p>1) In my.cnf I have set </p>
  
  <p>[mysqld]
   innodb_file_per_table</p>
  
  <p>(This works, I have one .ibd per .frm in the database folder.)</p>
  
  <p>2)I have checked if symlinks are ok with <code>SHOW VARIABLES LIKE "have_symlink";</code></p>
  
  <p>(I know that the documentation says:</p>
  
  <blockquote>
    <p>Symlinks are fully supported only for
    MyISAM tables. For files used by
    tables for other storage engines, you
    may get strange problems if you try to
    use symbolic links.</p>
  </blockquote>
  
  <p>But I need foreign keys...)</p>
  
  <p>3) I moved the database folder and created a symlink.</p>
  
  <p>4) Restarted mysql and tried:</p>
  
  <pre><code> mysql&gt; USE db_name
   Database changed
   mysql&gt; SHOW TABLES;
   ERROR 1018 (HY000): Can't read dir of './db_name/' (errno: 13)
   mysql&gt; exit
   user@comp# perror 13
   OS error code  13:  Permission denied
  </code></pre>
  
  <p>symlink is (as expected) <code>lrwxrwxrwx mysql mysql db_name -&gt; /path-to/db_name/</code></p>
  
  <p>database folder permissions are <code>drwx------ mysql mysql</code> </p>
  
  <p>all file permissions are <code>-rw-rw---- mysql mysql</code></p>
  
  <p>I am using Ubuntu 10.04 Server with MySQL 5.1.41 (default from apt).</p>
  
  <p>Have any of you done this successfully?</p>