[db]mysql全量迁移db
机房要裁撤, 原有的老业务机的mysql需要迁移到新的.
方案1: 全量打包拷贝data目录, 发现拷过去各种毛病
方案2: mysqldump逻辑导出解决问题
新的db刚安装好. 步骤记录下.
# 备份
mysqldump -uroot -A -B -R >/tmp/mysqlbak_$(date +%F).sql
# 导入用source
# 创建用户名授权
create database cube;
grant all on maotaidb.* to maotai@'%' identified by '123456';
grant all on maotaidb.* to maotai@'localhost' identified by '123456';
flush privileges;