DATE=`date +\%d-\%m-\%y-\%H:\%m:\%S`; /usr/bin/mysqldump -h localhost -u USERNAME -pPASSWORD DATABASENAME | gzip > /home/ACCOUNT-USER/mysql_backups/DATABASENAME-${DATE}.sql.gz

Where
USERNAME -> Database username
PASSWORD -> Database password
DATABASENAME -> Database name

Note:
Don’t remove “-p” let say that your database name is “mydatabase” and password is “1234abcd” and username is “myname”. It will be like that:

DATE=`date +\%d-\%m-\%y-\%H:\%m:\%S`; /usr/bin/mysqldump -h localhost -u myname -p1234abcd mydatabse | gzip > /home/ACCOUNT-USER/mysql_backups/mydatabse-${DATE}.sql.gz

Pin It on Pinterest

Share This