-2


I want to save the result of the query's execution into txt.
I do this query:

SELECT * FROM `users` INTO OUTFILE '/home/b/myuser/domain.xyz/public_html/first.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'

But I have some error like: "Error in query (1045): Access denied for user 'myuser'@'localhost' (using password: YES)"

How I can bypass this error?
I should use these permissions(not write and not edit files), because hackers install various scripts on my site.
Please, help me.

Kirill KZ
  • 71
  • 5
  • 1
    How are you connecting to database to execute this query? Error is that you are not able to connect to database. mysql -p – ankidaemon Aug 02 '16 at 13:13
  • 1
    There should not be any space between -p and your password. Check out this link for more detail: http://dev.mysql.com/doc/refman/5.7/en/connecting.html – ankidaemon Aug 02 '16 at 13:14
  • I do these queries via adminer (one file for using php) – Kirill KZ Aug 02 '16 at 13:38

2 Answers2

1

This is a problem with connection to database. It's not a problem with writing file...

Dave M.
  • 82
  • 9
1

Try following query:

SELECT * INTO OUTFILE '/home/b/myuser/domain.xyz/public_html/first.txt'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
FROM `users`
Ejaz47
  • 145
  • 1
  • 12