title: Change MySQL /tmp to /somedrive/mysqltmp in centos 7 for error code 28
body: <p>I am trying to change the temp location for MySQL from default <code>/tmp</code> to <code>/somedrive/mysqltmp</code> as i am getting </p>
  
  <blockquote>
    <p>Errcode: 28 - No space left on device</p>
  </blockquote>
  
  <pre><code>Solution: 1
  </code></pre>
  
  <p>I tried to add a line in <code>/etc/my.cnf</code> as <code>tmpdir=/somedrive/mysqltmp</code></p>
  
  <p>then issued  <code>sudo service mysql stop</code> and  <code>sudo service mysql start</code></p>
  
  <p>After restart, i still see <code>ERROR</code> remains.</p>
  
  <pre><code>Solution: 2
  </code></pre>
  
  <p>Based on <a href="https://dev.mysql.com/doc/refman/5.7/en/temporary-files.html" rel="nofollow noreferrer">this</a> I tried</p>
  
  <pre><code>mysqld --verbose --help | grep tmp
  
  tmp-table-size     16777216
  tmpdir             /tmp
  </code></pre>
  
  <p>and then i tried </p>
  
  <p><code>mysqld --tmpdir=/somedrive/mysqltmp</code> </p>
  
  <p>to change the defaults. But i am not able to change the tmp directory. I am not sure what i am missing!</p>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <h2>I figured this out: Do changes under</h2>
  
  <p><code>[mysqld]</code> as</p>
  
  <pre><code>tmpdir=/somedrive/mysqltmp
  </code></pre>
  
  <p>and then issue  <code>sudo service mysql stop</code> and  <code>sudo service mysql start</code></p>
  
  <p>Now check:</p>
  
  <pre><code>mysqld --verbose --help | grep tmp
  
  tmp-table-size     16777216
  tmpdir             /somedrive/mysqltmp
  </code></pre>