mysql - How to achieve redundancy between 2 tables of different databases? -


first of i'd start saying i've checked these 2 questions:

sync 2 tables of different databases - mysql

how synchronize 2 tables of different databases on same machine (mysql)

but while similar not need.

i have 2 databases in same server.

db1 , db2

both databases have exact copy of single table called "user":

userid  login  name  lastname  password  level 

how can achieve sort of redundancy between these 2 tables in different databases?

if db1.user gets new record db2.user has have record, if record modified other 1 modified , if deleted other 1 gets deleted too.

to more specific, db2.user needs reflection of db1.user using triggers.

edit: there question: mysql replication on single server , not remotely close want do. updated little bit @ end of posted how i'd achieve suggestion.

as proposed can use triggers stated in this standard documentation. define after insert,after update , after delete triggers on db1.user , within trigger have new.object pass information db2.user table.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -