Now Place:2uzhan.com » error while redirecting output to file

error while redirecting output to file

MySQL @ September 30, 2012   Views:0

I want to have output of my query in a file.
I used following command:

mysql> select * from pkg where name="NetworkManager" into outfile '/home/nshaikh/mysql_out/outfile.txt';

I am prompted by this error:

ERROR 1045 (28000): Access denied for user 'dump'@'localhost' (using password: YES)

I tried executing this query with a user other than root.
I have granted permission it(user) on the mydb.*

please reply with your valuable answers,
Thank you.

Edited 2 time(s). Last edit at 10/01/2012 03:30AM by Navid Shaikh.


[email protected] will need FILE privilege to be allowed to do this, or you will get the error message you have.

Good luck,
Barry. @Barry:
Thank you for reply,

I know how to grant permission to user(of linux os) in Linux OS, however I dont know how to how to grant permission to user (of mysql) to the file.

please reply with the query how to grant permission [email protected] to the file.

Thank you. See the refman for how to manage accounts and privileges.
The statement you want is probably

mysql> grant file on *.* to [email protected];

but check the manual to make sure.

Good luck,
Barry. Hi,
A new problem arose for me!
I can write into file, however I can not see the file crated.
The query shows it is successful, but I can not see the file in the file system.

Where the files goes?
Does it get stored in local db?
How can I look into the file?

Here is the query I run and the output of it->

mysql> select id, name from pkg_elffile into outfile '/tmp/result.csv' fields terminated by ',' optionally enclosed by '"' escaped by '\\' lines terminated by '\n';

Query OK, 63449 rows affected (0.04 sec)

$ ls /tmp/result.csv
ls: cannot access /tmp/result.csv: No such file or directory
please reply how can I access the file?

Thank you.

© 2018 2uzhan.com Contact