Home >Database >Mysql Tutorial >A brief analysis of how to regularly back up mysql data in CentOS 7?
How to regularly back up mysql data in CentOS 7? The following article will introduce to you the method of regularly backing up mysql data in CentOS 7. I hope it will be helpful to you!
Data backup is really important, because one day the data may be deleted inexplicably.
This article will introduce how to restore the system in CentOS Use
crontab and
mysqldump on 7
to regularly back up the data of mysql
. [Related recommendations: mysql video tutorial]
# 备份 repo 文件 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # 下载 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all # 清除缓存 yum makecache # 生成缓存 yum update
mysqldump
yum install -y mariadb
Since MySQL
is running in the Docker
container, it cannot be used locallysocket
To connect, you need to use the parameter -h127.0.0.1
.
# 定时任务中的 % 需要使用斜杆进行转义 0 1 * * * mysqldump -uzhangsan -ppassword -h127.0.0.1 dbName > /data/dbName_`date '+\%Y\%m\%d\%H\%M\%S'`.sql 2>&1
Original link: https://goworker.cn/posts/mysql- data-backup/
For more programming-related knowledge, please visit: Programming Video! !
The above is the detailed content of A brief analysis of how to regularly back up mysql data in CentOS 7?. For more information, please follow other related articles on the PHP Chinese website!