title: mysqlimport with Error 13
body: <p>I use the following script to import data from a <code>csv</code> file:</p>
  
  <pre><code>#!/bin/bash
  
  # show commands being executed, per debug
  set -x
  
  # define database connectivity
  _db="xxx"
  _db_user="xxx"
  _db_password="xxx"
  _table="movie"
  
  # define directory containing CSV files
  _csv_directory="/tmp"
  
  _csv_file='xxxxxx.csv'
  _header_columns_string='link,description,duration,thumbnaillink,iframe,tags,category'
  
  # import csv into mysql
  mysqlimport --fields-terminated-by=';' --lines-terminated-by="\n" --columns=$_header_columns_string -u $_db_user -p$_db_password $_db $_table $_csv_directory/$_csv_file
  
  exit
  </code></pre>
  
  <p>When I execute the script as root via <code>bash import.sh</code> I get the following error message:</p>
  
  <pre><code>+ _db=mydatabase
  + _db_user=xxx
  + _db_password=xxx
  + _table=movie
  + _csv_directory=/tmp
  + _csv_file=xxxxxx.csv
  + _header_columns_string=link,description,duration,thumbnaillink,iframe,tags,category
  + mysqlimport --local '--fields-terminated-by=;' '--lines-terminated-by=\n' --columns=link,description,duration,thumbnaillink,iframe,tags,category -u xxx -pxxx mydatabase movie /tmp/xxxxxx.csv
  mysqlimport: Error: 13, Can't get stat of '/var/lib/mysql/mydatabase/movie' (Errcode: 2), when using table: movie
  
  + exit
  </code></pre>
  
  <p>but the database and the table exist.</p>
  
  <p>The <code>csv</code> file exists and can be read, the table can be selected and I can manually insert data-rows into the db.</p>
  
  <p>What am I doing wrong?</p>