HelioHost Posted May 18, 2020 Posted May 18, 2020 Username: jomendes, Server: Johnny, Main domain: jomendes.heliohost.org Good morning. Is it possible in a Mysql DatabaseUse: SELECT *INTO OUTFILE 'Chart1.csv'FROM Chart1; To output it on a folder like : /home/jomendes/public_html/CSV Thanks a lot Best regards Jos=E9 Oliveira MendesUser jomendesMysql : jomendes_zcodiv
Krydos Posted May 20, 2020 Posted May 20, 2020 Yeah, I've never tried it myself, but that would probably work. It might be easier to write a php/python script to query the database and write the .csv file though.
wolstech Posted May 20, 2020 Posted May 20, 2020 PHP script is almost as easy and the same goal can be accomplished in a few lines (<10) of code. I'd personally go that route first simply because that method is going to be nearly universally supported. The MySQL method you're proposing should work here, but it won't work on many other web hosts (pretty much all hosts that have the DB servers on a different server from your homedir).
HelioHost Posted May 20, 2020 Author Posted May 20, 2020 Hello. I tried :SELECT * INTO OUTFILE '/home/jomendes/tmp/Chart1.csv' FROM Chart1; And SELECT * INTO OUTFILE 'Chart1.csv' FROM Chart1; But got this message: "Error Code : 1045Access denied for user 'jomendes_jom'@'148.63.118.236' (using password: YES)(156 ms taken)" Can you please confirm the right syntax to use for the Outfile (A directory where it works) Thanks a lot -----Original Message-----
Krydos Posted May 22, 2020 Posted May 22, 2020 You have to make sure the directory that you're outputting the file to is writable by the mysql process.
Recommended Posts