SELECT * FROM information_schema.`TABLES` where TABLE_SCHEMA = '数据库名';SELECT * FROM information_schema.`COLUMNS` where TABLE_SCHEMA = '数据库名' and TABLE_NAME = '数据表名';…
MySQL不同数据库之间表的简单同步,实用轻量级数据如下案列展示:例如我现在主库上面有users .tenants两张表需要同步到备库上面主库1.确认主库数据条数 select count(*) from users select count(*) from tenants 2.将数据导出到文件,/data/目录必须具有mysql对应的权限 select * into outfile '/data/users20180205.txt' from users; select * into outf…
1.MySQL的复制相同表结构方法: 1)create table table_name as select * from table1 where 1=2 (或者limit 0): 2) create table table_name like table1_name; 二者的用途: as :用来创建相同表结构并复制源表数据.(可根据后面的条件来控制要不要复制源表数据) like:用来创建完整表结构和全部索引. 二者的区别: as :创建出来的table_name缺少table1的索引信息,…