1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Rep Power

    MySQL command line output to csv from remote

    Hi - I am trying to get the following command line to run on my Mac using the Mac's Terminal.app:

    mysql -uuser_id –ppassword database_name -B -e "select * from table_name;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > mysql_exported_table.csv

    I get the following error: - bash mysql: command not found

    MySQL is installed on a remote server. My Mac is running OS X. I have MySQL Workbench installed which is how I access the remote server. I do not have any other MySQL software installed on my Mac.

    Do I need any MySQL software installed locally?

    Thanks - John
  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Stockholm, Sweden
    Rep Power
    Yes, the first mysql in your line is the mysql client software that needs to be installed locally.

IMN logo majestic logo threadwatch logo seochat tools logo