0%
1.Create sh script file
2.Copy this code and paste it into backup.sh script file
1 2 3 4 5 6 7 8 9
| #bin/sh MYSQLDUMP=YOUR_MYSQLDUMP_PATH MYSQL_USERNAME=YOUR_MYSQL_USERNAME MYSQL_PASSWORD=YOUR_MYSQL_PASSWORD MYSQL_HOST=YOUR_MYSQL_HOST MYSQL_PORT=YOUR_MYSQL_PORT MYSQL_DB=YOUR_MYSQL_DB SQL_NAME=${MYSQL_DB}"_""`date "+%Y%m%d%H%M%S"`"".sql" ${MYSQLDUMP} -u${MYSQL_USERNAME} -h${MYSQL_HOST} -P${MYSQL_PORT} -p${MYSQL_PASSWORD} ${MYSQL_DB} > ./${SQL_NAME}
|
3.Modify file permissions
4. Execute sh script file