标签:
MySQL中的逻辑备份是将数据库中的数据备份为一个文本文件,备份的文件可以被查看和编辑。在MySQL中,使用mysaldump工具来完成备份。有以下3种来调用mysqldump:
shell>mysqldump [option] db_name [tables]
shell>mysqldump [option] --database DB1 [DB2 DB3...]
shell>mysqldump [option] --all-database
[cqh@localhost ~]$ mysqldump -uroot -p --all-database > all.sql
[cqh@localhost ~]$ mysqldump -uroot -p test > test.sql
[cqh@localhost ~]$ mysqldump -uroot -p test emp > emp.sql
[cqh@localhost ~]$ mysqldump -uroot -p test emp dept > emp_dept.sql
[cqh@localhost ~]$ mysqldump -uroot -p -T /tmp test emp --fields-terminated-by ‘,‘
mysql -uroot -p dbname < bakfile
mysqlbinlog binlog-file | mysql -uroot -p
shell>mysqlbinlog --stop-date="20150929 9:59:59" /var/log/mysql/bin.123456 | mysql -uroot -pmypwd
shell>mysqlbinlog --start-date="20150929 10:01:00" /var/log/mysql/bin.123456 | mysql -uroot -pmypwd
shell>mysqlbinlog --start-date="20150929 9:55:00" --stop-date="20150929 10:05:00" /var/log/mysql/bin.123456 > /tmp/mysql_restore.sql
shell>mysqlbinlog --stop-position="551212" /var/log/mysql/bin.123456 | mysql -uroot -pmypwd shell>mysqlbinlog --start-position="551215" /var/log/mysql/bin.123456 | mysql -uroot -pmypwd
标签:
原文地址:http://www.cnblogs.com/chenqionghe/p/4848424.html