mysql中怎么实现物理备份和增量备份-成都快上网建站

mysql中怎么实现物理备份和增量备份

本篇文章为大家展示了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;

上述内容就是mysql中怎么实现物理备份和增量备份,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注创新互联行业资讯频道。


当前文章:mysql中怎么实现物理备份和增量备份
路径分享:http://kswjz.com/article/jeojpd.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流