Forums

Export database table to excel

I wonder how to export table from database to excel file. Should I export it in bash or mysql console?

I used this query and got an error.

    select * from account INTO OUTFILE 'userInfo.csv' FIELDS ENCLOSED BY '"' 
        -> TERMINATED BY ';';
    ERROR 1045 (28000): Access denied for user 'sunyk'@'%' (using password: YES)

And in bash

Access denied for user 'sunyk'@'10.0.0.64' (using password: YES) when trying to connect

what command did you run? (eg: were you connecting to the correct database table?)

I am having a similar issue - didn't see any resolution here so I thought I'd note it.

I started a MySQL shell via bash using the following command - replacing the xx---xx items with the relevant information: mysql -h xxmyloginxx.mysql.pythonanywhere-services.com -u xxmyloginxx 'xxmyloginxx$xxmyschemaxx' -p --local-infile=1

I've used this successfully for loading from infile, wondering .. is there perhaps something different needed when writing to outfile?

thanks!! :)

I think it may be a permissions thing. Check this out for how to use mysqldump instead of outfile.