MySQL Replication Errno1146 Table doesn’t exist

MySQLmysql-replication

Here's the setup: I have a MySQL DB cluster in Rackspace that I'm already using for replication to multple slaves in multiple datacenters. I am trying to use AWS' Aurora with a MySQL front-end, which I've had working before, but now replication is breaking. This is the error that i'm seeing

Last_Errno: 1146

Last_Error: Error 'Table 'SOME_DB_NAME2.segment' doesn't exist' on query. Default database: 'SOME_DB_NAME2'. Query: 'DELETE FROM segment WHERE 1'

The problem is, is that I have only imported one database called SOME_DB_NAME1, NOT SOME_DB_NAME2. So the error that i'm getting for a table that doesn't exist in my database at all is really strange.

I exported 1 database from my Rackspace DB cluster to setup replication, and when I import that 1 database into Aurora and kick off replication, it almost immediately failes and gives me the Errno: 1146 for a table that doesn't even exist in the 1 database that I brought over. I've done a SHOW TABLES; using the 1 database that I brought over, and i've confirmed that the problematic table doesn't even exist. I don't know if maybe I have to grab ALL databases from Rackspace and bring them over to initiate replication, even though I just wanted 1 of the databases…

Best Answer

It sounds to me like you need a -replication-do-DB statement on your slave so that it will only attempt to run queries from the database that you are trying to replicate. Otherwise as noted in the comments it will attempt to run statements on all databases (even the ones that don't exist) and create the error identified.

Related Topic