1.导出
mysqldump -h hostname -uroot dbname >dbname_$(date +"%Y%m%d").sql -p
2.导入
mysql -uroot dbname<dbname_$(date +"%Y%m%d").sql -p
3.MySQL 数据字典导出脚本
SELECT TABLE_NAME
,COLUMN_NAME
,column_type
,is_nullable
,column_default
,column_comment
,column_key
,extra
FROM information_schema.columns WHERE table_schema='dw_prod'
ORDER BY 1 ASC;