Question: I am getting error when using load data to insert the query .

```
"load data infile '/home/bharathi/out.txt' into table Summary"

```

This file is there in the location . But mysql throws the below error .
**ERROR 29 (HY000): File '/home/bharathi/out.txt' not found (Errcode: 13)**

```
show variables like 'data%';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------+

```

Data Dir is pointing to root permissioned folder . I can't change this variable because it's readonly . 

How can I do the load data infile operation ?

I tried changing file permissions , load data local infile . It wont work .

Answer: 
As documented under [`LOAD DATA INFILE` Syntax](http://dev.mysql.com/doc/en/load-data.html):

> 
> For security reasons, when reading text files located on the server, the files must either reside in the database directory or be readable by all. Also, to use [`LOAD DATA INFILE`](http://dev.mysql.com/doc/en/load-data.html) on server files, you must have the [`FILE`](http://dev.mysql.com/doc/en/privileges-provided.html#priv_file) privilege. See [Section 6.2.1, “Privileges Provided by MySQL”](http://dev.mysql.com/doc/en/privileges-provided.html). For non-`LOCAL` load operations, if the [`secure_file_priv`](http://dev.mysql.com/doc/en/server-system-variables.html#sysvar_secure_file_priv) system variable is set to a nonempty directory name, the file to be loaded must be located in that directory.
> 
> 
> 

You should therefore either:

* Ensure that your MySQL user has the `FILE` privilege and, assuming that the `secure_file_priv` system variable is not set:

	+ make the file readable by all; or
	+ move the file into the database directory.
* Or else, use the `LOCAL` keyword to have the file read by your client and transmitted to the server. However, note that:

> 
> `LOCAL` works only if your server and your client both have been configured to permit it. For example, if [*`mysqld`*](http://dev.mysql.com/doc/en/mysqld.html) was started with [`--local-infile=0`](http://dev.mysql.com/doc/en/server-system-variables.html#sysvar_local_infile), `LOCAL` does not work. See [Section 6.1.6, “Security Issues with `LOAD DATA LOCAL`”](http://dev.mysql.com/doc/en/load-data-local.html).
> 
> 
>
The solution which really worked for me was to:

```
sudo chown mysql:mysql /path/to/the/file/to/be/read.csv

```

Adding it for future reference.