Home > Database > Mysql Tutorial > body text

Mysql备份恢复调优_MySQL

WBOY
Release: 2016-06-01 13:34:31
Original
906 people have browsed it

bitsCN.com

Mysql备份恢复调优

 

Mysql 备份与恢复

mysqldump,ibbackup,replication

 

备份分:

Hot Backup(热备)    在线备份,对DB无影响

Cold Backup(冷备)    停止时备份,简单,拷贝物理文件,离线备份

    frm数据库文件,共享表空间文件,独立表空间ibd文件,重做日志文件的备份 。   DBA脚本备份,并打包与压缩。

Warm Backup(温备)    DB运行时备份,对DB操作有影响,会加一个全局读锁来保证备份数据的一致性。

 

逻辑备份是指备份文件内容是可读的,通常是文本文件,内容一般为SQL语句,可表的实际数据,如mysqldump和select * into OUTFILE。用于数据库升级,迁移,恢复时间较长。

    mysqldump --all-databases > file_name ;备份所有数据库

    mysqldump --databases db1 db2 db3 >dbs.sql ;备份指定的库

    mysqldump --single-transaction test>test_backup.sql; 对test架构进行备份。

    select * into OUTFILE ;多用于导出表的数据;

    select * into outfile 'xxxx' from a;    恢复时用  load data infile 'xxx' into table a;

    

    恢复

    mysql -uroot -p

    source  ....xxx.sql 

    

    mysql 可以导出存储过程,触发器,事件,数据,但是不能导出视图。

    

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!