All Databases
You need SSH access and possible Super User Privileges to run this commands.
Single Databases"
If you're just trying to backup a simple database you can run this command
You need SSH access and possible Super User Privileges to run this commands.
mysqldump --all-databases | gzip > /path/backups/backup_$(date "+%b-%d-%Y-%H-%M-%S").sql.gz
mysqldump
: utility to dump mysql database-u
specifies the user with mysql privileges with DB privileges.. In this tutorial, I am using root user-p
specifies the password flag needed by the user.-h
flag specifies the host you are connecting to.. You can simply ignore this if its localhost but if it's a remote IP, you need to specify the IP address..gzip
: Utility to compress the .sql file after dump file is created.date
: $(date "+%b-%d-%Y-%H-%M-%S") by adding this you are giving a date and time to your backups...Single Databases"
If you're just trying to backup a simple database you can run this command
mysqldump -h localhost -u root -ppassword dbname | gzip > /path/backups/backup_$(date "+%b-%d-%Y-%H-%M-%S").sql.gz