title: Error 13 when executing mysqldump to export a database into a cvs file
body: <p>I would like to export my database into a .csv file but I got a problem when I execute the command to do that: </p>
  
  <pre><code>   mysqldump -u root -p -t  -T~/tesht/ database orders --fields-terminated-by=',' 
      mysqldump: Got error: 1: "Can't create/write to file '/home/motocol/tesht/orders.txt' (Errcode: 13)" when executing 'SELECT INTO OUTFILE'
  </code></pre>
  
  <p>Doing some research about the problem I found this: </p>
  
  <blockquote>
    <p>It is important to note that the directory you specify must be
    writeable by the user the MySQL server runs as. If it is not, you'll
    get an error like this:</p>
    
    <p>mysqldump: Got error: 1: Can't create/write to file
    '/path/to/filename.txt' (Errcode: 13) when executing 'SELECT INTO
    OUTFILE' If your Linux machine has SELinux enabled, then the directory
    must also be allowed by the SELinux configuration for MySQL to write
    to.</p>
  </blockquote>
  
  <p>Which is exactly what I get as an error, however I already thought I did that following the instruction on this <a href="https://stackoverflow.com/questions/26474222/mariadb-10-centos-7-moving-datadir-woes">post</a> by running:</p>
  
  <p>Ensure the user:group is mysql:mysql
  Set the SELinux tag to mysqld_db_t
  Set the SELinux user to system_u</p>
  
  <p>and now when I do ls -Z I get: </p>
  
  <pre><code>drwxrwxr-x. 2 mysql   mysql      6 Nov 16 16:21 tesht
  </code></pre>
  
  <p>but I still get the same error. Any ideas?</p>