从MySQL全备文件中恢复单个库或者单个表

从MySQL全备文件中恢复单个库或者单个表

提取建库语句

sed -n '/^-- Current Database: db_cms/,/^-- Current Database: `/p' backup.sql > db_cms.sql &

提取ddl

sed -e'/./{H;$!d;}' -e 'x;/CREATE TABLE t_user/!d;q' backup.sql > t_user.sql &

提取dml

grep -i 'INSERT INTO t_user' backup.sql >> t_user.sql &

如何从MySQL全备文件中恢复单个库或者单个表

猜你喜欢

转载自www.cnblogs.com/okokabcd/p/9352344.html