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

    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    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
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    Yes, the first mysql in your line is the mysql client software that needs to be installed locally.
    /Stefan

IMN logo majestic logo threadwatch logo seochat tools logo