您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 吴忠分类信息网,免费分类信息发布

mysql的物理备份和增量备份_MySQL

2024/6/30 7:33:39发布95次查看
bitscn.com
物理备份:
mysql
               show variables like'datadir';
                use hellodb;
                show table status;
                mysql
             flush logs with read lock;
             /q
             lvcreate -l 50m -n mysnap -s /dev/myvg/mydata
             mysql     
             unlock tables;
               /q
              mount /dev/myvg/mysnap /mnt
             cd /mnt
             cd data/
             ls
             tar -jcf /root/mysql.tar.bz2   hellodb ibdata1 ib_logfile* mysql-bin* 
            ls
            cd
             umount /mnt
              lvremove --force /dev/myvg/mysnap
             service mysqld start
              ls /mydata/data
             rm -rf  /mydata/data/*
              cd /usr/local/mysql
                 chown -r mysql:mysql data/ 
              scripts/          --datadir=/mydata/data --user=mysql
              killall mysqld
              service mysqld start
              service mysqld stop
                cd /mydata
                  cd data
                   ls
                   tar xf /root/mysql.tar.bz2 -c ./
                     ls
              service mysqld start
              mysql
              show databases;
增量备份:
            show master status
             lvcreate -l 50m -n mysnap -s /dev/myvg/mydata
              mysql     
             unlock tables;
              tar -jcf /root/mysql.tar.bz2   hellodb ibdata1 ib_logfile* mysql-bin* 
             mysql
             use hellodb;
                 insert into t2 values('huhu')
              show master status;
               mysqlbinlog --start-position  201 mysql-bin.000004 >/root/mysql2.incr.sql
            cd
              serviece mysqld stop
              rm -rf /mydata/data/*
             cd /usr/local/mysql
                 chown -r mysql:mysql data/ 
              scripts/          --datadir=/mydata/data --user=mysql 
               service mysqld start
               serviece mysqld stop
                cd /mydata/data/
                tar xf /root/mysql.tar.bz2 -c ./    
                 service mysqld start
                 mysql
                 use hellodb;
                 select * from t2;
                 #mysql                  mysql
                 use hellodb;
                 select * from t2;
作者“linux”
bitscn.com
吴忠分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录