[14:46:01] hallo [14:46:07] I'm on terbium [14:46:12] did `sql cawiki` [14:46:29] tried to run a query with INTO OUTFILE '/tmp/cawiki.csv'; [14:46:37] got: ERROR 1045 (28000): Access denied for user 'wikiadmin'@'10.%' (using password: YES) [14:46:44] IIRC, it used to work [14:47:02] how can I make it work? [14:48:31] aharoni: sounds like springle is locking down db grants for enhanced security. best would be a ticket so we can poke him later [14:49:58] gbrdtbrgrgrg [14:51:10] I can see the query results, but I probably don't have a permission to save it to a file. [14:52:26] apergos: ^ any idea? [14:52:55] hrm [14:53:18] cna't you tee it from mysql cmd line? [14:53:18] aharoni: how about letting it write into your homedir ? i expected the error to be different though when it's filesystem permission [14:53:27] into a local file of your choice [14:53:56] into outfile is on the server all right, so that would be fail [14:54:21] I suspect that it writes to another server. [14:54:46] yes, it would be trying to write on whatever db server runs the query, not on your local host [14:54:57] this is why tee inside of mysql cmd prompt is your friend [14:56:16] apergos: hmmm... how do I do that? just add ` tee` before select? [14:56:21] um no [14:56:23] sec [14:57:12] http://bencane.com/2011/12/26/mysql-tee-saving-your-output-to-a-file/ you just 'tee /my/full/path/to/file' at the prompt [14:57:20] and I think it will save the commands you type too but whatever [14:57:30] you can head or tail those out if you don't want them [14:58:17] notee will turn it off [15:00:15] apergos: let's see... [15:00:29] just do some tiny query to see how it works [15:10:12] apergos: it seems to work, and now the question is how to format it in CSV. [15:10:36] what I can google up is for `into outfile`, which is not what I want [15:12:02] FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' [15:12:15] you can still use that when dropping the INTO OUTFILE part [15:13:17] or you can do something like [15:14:59] ah csv uhhhh [15:15:09] sec [15:15:37] select CONCAT(foo, ', [15:15:52] select CONCAT(foo, ', ', bar) [15:16:02] sorry, laggy connection here [15:19:40] I don't know a nice way to do it except by using a conversion script on the output [15:19:46] you can gt tab formatted I think [15:20:59] http://www.electrictoolbox.com/mysql-export-data-csv/ you can remove the "INTO outfile" line [15:21:42] something like this: https://github.com/brendano/tsvutils no idea if that is any better than any other script, chosen at random [15:25:51] mutante: I suspect that I cannot remove the `into outfile` part [15:26:05] https://github.com/onyxfish/csvkit that might be able to do the work for you [15:26:37] I would be surprised if no one in analytics has such a conversion script lying around already [15:26:41] seems suspicious :-) [15:43:37] aharoni: mysqldump has these --fields-terminated-by etc. look for "mysqldump into csv" etc. drawback here you would do the entire table but you don't have to run it on the same machine [15:47:34] mutante: apergos - stackoverflow to the rescue, as always :) [15:47:36] http://stackoverflow.com/questions/12040816/mysqldump-in-csv-format [15:47:53] the first answer there, with sed, does the simplest thing that I need [15:48:28] if you might have commas or embedde tabs or whatever this iwll not be enough [15:48:38] if your data is simple... then yeah ( would have awk sed right away [15:48:47] i was on that identical page just now:) [15:48:59] if it works for your ata that's the important thing :-) [15:49:01] *data [15:50:25] works :) [16:00:34] great!