rugg Posted February 22, 2018 Share Posted February 22, 2018 Hi, i want to download the two table, both tblinvoiceitems and tblinvoices . what i do now is go to phpmyadmin >> select one table >> export, and choose CSV with "Put columns names in the first row". i want to ask if any script or command that i can use, and it can backup as tblinvoiceitems-date-time.csv and store on certain folder, such as tblinvoiceitems-20180220-112420.csv, is it possible ? thanks alot. Link to comment Share on other sites More sharing options...
twhiting9275 Posted February 23, 2018 Share Posted February 23, 2018 You can use mysqldump to create an automated cron that will do what you're looking for. Something like this will do what you need. Save this as a cron job outside of your web directory (don't save in public_html), change the variables you need, make sure this is given execute permissions (u+x), and it'll do what you want #!/bin/sh myuser="YOUR MYSQL USER" mypass="YOUR MYSQL PASS" backupdir="/home/user/backups" tables_to_dump="TABLES TO DUMP" database="YOUR MYSQL DB" timestamp=`date +%m%d%y-%H%M%S` mysqldump -u$myuser -p$mypass $database $tables_to_dump >> $backupdir/$timestamp.sql Link to comment Share on other sites More sharing options...
Recommended Posts