MySQL – Master to Slave setup question

MySQLreplication

i have now setup a Master => Slave setup, after hard fightning its now working and this is great.

the next step is, how can tell the slave if i create a new table/stroed procured or function on my Master its need to copy that to?

right now i need to run my sync script for on the master and the slave, i think if i got a lot of slaves this will be a big problem, so i hope there are a friendly person there can explain what to do now?

so what i need is i'm only need to consentrat about my Master setup, and lat the slaves copy every thing from my master and not only the row's i, can i that? and how.

Best Answer

The intent of replication is that the dataset on the Slave is always identical to what is on the Master.

But, Stored Procedures, Stored Functions, Triggers, and Events may (or may not) do things that should not be re-done on the slave. Therefore, you must decide case by case whether you want them to be on both servers.

To apply a CREATE to all your slaves -- that should be as simple as a script that connects to each slave and performs the same query.

mysqldump is cautious about dumping such Routines, for fear that you will use the dump to initialize a Slave.

The prime example of something that should not be on the Slaves: A Trigger that Inserts a row into another table. And you have Row Based Replication. The Insert is already sent to the Slave via RBR, and the Slave has no way to perform a Trigger on something in the replication stream anyway.