16.4.1.4 Replication of CREATE ... IF NOT EXISTS Statements

This section discusses the rules that are applied when various CREATE ... IF NOT EXISTS statements are replicated.

Previous to MySQL 5.1.38.  CREATE DATABASE IF NOT EXISTS was replicated only if the database named in the statement did not exist on the master. CREATE TABLE IF NOT EXISTS was replicated only if the table named in the statement did not exist on the master.

MySQL 5.1.39 and later.  Every CREATE DATABASE IF NOT EXISTS statement is replicated, whether or not the database already exists on the master. Similarly, every CREATE TABLE IF NOT EXISTS statement is replicated, whether or not the table already exists on the master. This includes CREATE TABLE IF NOT EXISTS ... LIKE. However, replication of CREATE TABLE IF NOT EXISTS ... SELECT follows somewhat different rules; see Section 16.4.1.5, “Replication of CREATE TABLE ... SELECT Statements”, for more information.

Replication of CREATE EVENT IF NOT EXISTS.  CREATE EVENT IF NOT EXISTS is always replicated, whether or not the event named in the statement already exists on the master. This is true for all MySQL 5.1 releases beginning with MySQL 5.1.6, when this statement was introduced.

See also Bug #45574.