创建插入触发器以将相同记录插入不同服务器(远程服务器) [英] Create a insert trigger to insert the same record into diffrent server (remote server)

查看:93
本文介绍了创建插入触发器以将相同记录插入不同服务器(远程服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



使用MySQL,我在服务器1上安装了表1的DB 1,在服务器2上安装了表1的数据库2.不在同一网络和T1上包含相同数据类型的相同列。



我想在DB 1上创建一个触发器,这样当数据库1上的T1插入时,插入了所有数据在T1中复制(或插入)到T1但在服务器2上的DB 2上的T1。







伙计你可以帮助我吗

Hello

Using MySQL, I have DB 1 with table T1 on Server 1 and DB 2 with table T1 on Server 2. Not on the same network and T1 contain the same columns with the same datatypes.

I want to create a trigger on DB 1 so when there is a insert on T1 on DB 1, all the data inserted in T1 is copied (or inserted) into T1 but the T1 that is on DB 2 on Server 2.



Guys Can u plz help me if it is possible

推荐答案

建议以下选项,使用批处理脚本,你需要从T1 / Server1导出数据并导入到T1 / Server2



导出和导入可以使用mysqldump命令完成。



批处理脚本可以使用具有所需频率的cron作业执行(每日/每小时等)
Suggest following option, using the batch script, you need to export the data from T1/Server1 and import into T1/Server2

export and import can be done using mysqldump command.

Batch script can be executed using a cron job with the required frequency (daily / hourly etc)


这篇关于创建插入触发器以将相同记录插入不同服务器(远程服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆