Posted on April 1, 2018 at 9:40 pm
MySQL command to export data in CSV format:
SELECT id,product,quantity FROM orders WHERE foo = 'bar' INTO OUTFILE '/var/lib/mysql-csv/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
Use this command from bash shell to export MySQL to CSV:
nohup mysql -h localhost -u username -p'password' databasename -e "SELECT id,product,quantity FROM orders INTO OUTFILE '/var/lib/mysql-csv/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\'' LINES TERMINATED BY '\n';" > /dev/null 2>&1 &
The above command will run in background.
- Convert POST Fields to Objects in jQuery
- How to Sleep/Wait in jQuery (Synchronous)
- How to Install and Configure Mitmproxy on Windows
- Exclude Packages from Apt-Get Upgrade on Debian Linux
- What is the Correct JSON Content-Type for HTTP Headers?
- What to Select on GRUB-PC Configuration "Install Devices"
- How to Permanently Run NodeJs Script in Background
- How to Stop NodeJs Puppeteer Follow Redirects
- 3 Cards in a Row with Bootstrap 4.4
- Debug 502 Errors in Google Cloud Load Balancer
- Python if-then-else in one line example
- How to urlencode() an URL in Python3
- How to Install Python PIP on Debian
- Install Required Fonts for Puppeteer
- Passing a boolean through HTTP GET request
- PHP Convert Boolean to String