Here is the Linux command line for backing up all tables in YOURDATABASENAME to split files in a specific path:
You need to replace YOURDATABASENAME and YOURPATH with the appropriate values.
for I in $(mysql --database=YOURDATABASENAME -e 'show tables' -s --skip-column-names); do mysqldump YOURDATABASENAME $I | gzip > "/YOURPATH/YOURDATABASENAME/$I.sql.gz"; done
I use this as a scheduled cron job to back up all tables daily.
NOTE. If you use this from the Linux command line, you will need to add a user with global privileges to the database for YOURUSERNAME@localhost without a password. Otherwise, you will need to add the user and password parameters to the script as follows, but this will require a password for each table!
for I in $(mysql -u MYSQLUSERNAME -p --database=YOURDATABASENAME -e 'show tables' -s --skip-column-names); do mysqldump -u MYSQLUSERNAME -p YOURDATABASENAME $I | gzip > "/YOURPATH/YOURDATABASENAME/$I.sql.gz"; done
source share