0

On a mysql 5.7 master, the following command generates syntax error.

CHANGE REPLICATION FILTER REPLICATE_DO_DB = ('mydb')
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'REPLICATION FILTER REPLICATE_DO_DB = ('mydb')' at line 1

I have tried it with or without single quote around database name. official guide

1
  • @Philᵀᴹ I tried it with or without quote.
    – Tiina
    Commented Apr 28, 2019 at 8:52

3 Answers 3

1

CHANGE REPLICATION FILTER REPLICATE-DO-DB is a SLAVE filter to read only (mydb) from the relay log.

If you want to filter the Master to write only (mydb) statements on the binary logs (and replicate only (mydb) to all slaves), you need to use the --binlog-do-db=name variable (Link) on master server.

0

The syntax error is pointing at the word REPLICATION, so the problem is there or immediately before there. It is not about quoting the db name.

This feature was added in 5.7; what version are you running?

This command applies only to Slaves.

This command cannot be used with Group Replication.

0

For versions below 5.7 it seems the value can be set as command line parameter only. For example:

mysqld --replicate-do-do=mydb

https://downloads.mysql.com/docs/refman-5.6-en.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.