• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

mysql export syntax from within DB

I'm trying to export a query from a mysql command , but I keep getting the error

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

Do I need to back out of the database and run from the line below?

[_mamdoh@74 ~]$

This is what I'm using.

SELECT * INTO OUTFILE "C:\Documents and Settings\ckwill\My Document\newfile.csv"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "\n"
FROM Clients;
0
ckwillGWU
Asked:
ckwillGWU
1 Solution
 
hieloCommented:
Those backslashes need to be back-to-back backslashes:
SELECT * INTO OUTFILE "C:\\Documents and Settings\\ckwill\\My Document\\newfile.csv"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "\n"
FROM Clients;

Additionally, the error description indicates that the user account you are using (_mamdoh) does not have permission to exucute that command. Login as admin and then try executing the command again.

On the following url, there is an alerternative way to dump the data onto a file:
http://www.mysqlfaqs.net/mysql-faqs/Data-Back-Up/Export-Data/How-to-export-table-data-to-text-file-with-SELECT-INTO-OUTFILE-statement
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now