lepix
lepix

Reputation: 4990

Disable replication for some MySQL queries

I have a PHP script that execute a lot of queries (multiples CREATE TEMPORARY TABLE) in order to UPDATE one and unique table.

I would like to skip replication on the CREATE TEMPORARY TABLE and only replicate the UPDATE query.

How can I achieve that ? I tried to disable the mysql_bin_log but it doesn't work (the mysql user has SUPER privilege)s:

mysql_query("SET sql_log_bin=0;");
$i = mysql_fetch_assoc(mysql_query("SHOW VARIABLES LIKE 'log_bin';"));
var_dump($i['Value']); // Return : ON

Upvotes: 0

Views: 544

Answers (1)

tamerlaha
tamerlaha

Reputation: 1990

You should use replicate-wild-ignore-table=NotRep% and create your tables with NotRep prefix.

CREATE TEMPORARY TABLE NotRepTableForSmthn (...)

see http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_replicate-wild-ignore-table for details.

Upvotes: 1

Related Questions