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

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

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

2 Answers 2


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.


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.

Your Answer

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

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