0

I have exported my mysql databse into a .sql file using the command

$ sudo mysqldump Company_Employee_Projects > dump.sql

I would like to simply convert this .sql file into a .csv file without being too fussy for now about the format of the csv file. There are numerous threads that provide simple solutions and one that I want to specifically carry out was this answer by user stan:

$ mysql Company_Employee_Projects --password=PASSWORD < dump.sql > out.csv

Entering that command gave me an Error 1045 (28000): Access denied for user 'USERNAME'@'localhost' (using passwod : NO) even though I entered the password that I set for sql. Note that PASSWORD and USERNAME are fields which are placeholders to the actual string I typed out. Nevertheless, when I sudo the same command, my PC (the server) takes a moment and outputs a .csv file. However, the file size indicates 0 Bytes and opening the file shows a blank document. The .sql file is extremely small so I doubt there is any lag or processing which delays the output .csv file. May anyone provide any hints as to what is the problem in trying to specifically implement stans solution?

Dean P
  • 676
  • 8
  • 16
  • You can't convert a `.sql` file to `.csv` this way. Also running a dump will **delete and replace all data in your database**. MySQL can export SQL using `SELECT ... INTO OUTFILE`, but that requires running commands not present in the dump. – tadman May 01 '20 at 21:53
  • ```mysqldump -u user -p yourDatabaseName > outputFileName.csv``` isn't working ? – Dhanushka sasanka May 01 '20 at 22:08

0 Answers0