版权声明:本文为博主原创文章,欢迎转载,请注明出处 https://blog.csdn.net/mouday/article/details/90727803
同库
1、目标表不存在
存在会报错,对student表 做一个一样的表student_replica
create table student_replica select * from student
2、目标表存在
将表student 的数据插入到表 student_replica 中
insert into student_replica select * from student
不同库
# 数据导出
$ mysqldump -hlocalhost -P3306 -uroot -p123456 demo table > table.sql
# 数据导入
$ mysql -hlocalhost -P3306 -uroot -p123456 demo < table.sql
# 或者
> use db;
> source table.sql;