mysql常见的备份方法
1、使用tar包装文件夹备份。数据库可以直接保存data文件夹,但是占用空间大,可以用tar包装压缩保存。
[root@localhost ~]# systemctl stop mysqld [root@localhost ~]# tar Jcvf /opt/mysql-$(date +%F).tar.xz /usr/local/mysql/data/ [root@localhost ~]# ls /opt/ mysql-2021-10-25.tar.xz [root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysqldump -u root -p123456 --databases info > /opt/info.sql #对info库进行备份 [root@localhost ~]# ls /opt/ info.sql

浙公网安备 33010602011771号