Output MySQL source results to log file
From within your MySQL client, type tee session.out From that point on, all the I/O of in your current client session is written to the file ‘session.out’
From within your MySQL client, type tee session.out From that point on, all the I/O of in your current client session is written to the file ‘session.out’
From the manual: The SELECT … INTO OUTFILE statement is intended primarily to let you very quickly dump a table to a text file on the server machine. If you want to create the resulting file on some client host other than the server host, you cannot use SELECT … INTO OUTFILE. In that case, … Read more
I think your statement should look like: SELECT id, client, project, task, description, time, date INTO OUTFILE ‘/path/to/file.csv’ FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ FROM ts Mainly without the FIELDS ESCAPED BY ‘””‘ option, OPTIONALLY ENCLOSED BY ‘”‘ will do the trick for description fields etc and your numbers … Read more
No, there’s no way to overwrite it. From the docs: file_name cannot be an existing file, which among other things prevents files such as /etc/passwd and database tables from being destroyed. It might be a better idea to use a different filename each night, as having multiple backups means you can recover from problems that … Read more
Try executing this SQL command: > grant all privileges on YOUR_DATABASE.* to ‘asdfsdf’@’localhost’ identified by ‘your_password’; > flush privileges; It seems that you are having issues with connecting to the database and not writing to the folder you’re mentioning. Also, make sure you have granted FILE to user ‘asdfsdf’@’localhost’. > GRANT FILE ON *.* TO … Read more
Which particular version of Ubuntu is this and is this Ubuntu Server Edition? Recent Ubuntu Server Editions (such as 10.04) ship with AppArmor and MySQL’s profile might be in enforcing mode by default. You can check this by executing sudo aa-status like so: # sudo aa-status 5 profiles are loaded. 5 profiles are in enforce … Read more
You’d have to hard code those headers yourself. Something like: SELECT ‘ColName1’, ‘ColName2’, ‘ColName3’ UNION ALL SELECT ColName1, ColName2, ColName3 FROM YourTable INTO OUTFILE ‘/path/outfile’