Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MYSQL V5 and higher Trigger

Posted on 2011-02-14
1
Medium Priority
?
254 Views
Last Modified: 2012-05-11
Cannot find allot of info on this matter so i would appreciate  some input.

I have stock that is changed on 1 server and stock that is changed on a other. To make sure both stock levels are the same i want to insert a trigger on both servers that update the central database.

So here is a example to clarify.

SERVER 1 datebase 1 = the wepshop
SERVER 2 datebase 2 = local administration
SERVER 2 datebase 3 = central stock

If any stock from db 1 has changed i want to get the stock from db 3 and deduct or add the stock from 3 and insert the new stock into all 3 databases.
edit: also need from db 2 to db 3
Is this even possible using mysql in phpadmin?]

also note that Server 1 and 2 are at different locations with different login.









 
0
Comment
Question by:ScottNL1
1 Comment
 
LVL 26

Accepted Solution

by:
Tomas Helgi Johannsson earned 2000 total points
ID: 34895265
           Hi!

What about using the Fedarated storage engine ?
Using federated table in db1 and db2 where the physical table is in db3 would solve your problem
and you would have one stock table but it would be accessible in all 3 databases.
Also that would simplify the maintainance of the stock table.

http://dev.mysql.com/doc/refman/5.1/en/federated-storage-engine.html
http://dev.mysql.com/doc/refman/5.1/en/federated-create.html

Hope this helps.

Regards,
     Tomas Helgi


0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 10 hours left to enroll

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question