Take care when renaming databases if your mysql server is replicated

This is something I should have realised, but obviously didn’t until someone else pointed out. I was trying to workout why the replication wasn’t working.

I had a database for FTP - pureFTPD

This was ignored on the replication settings. Since I’m no longer using FTP, I decided to remove it. However, I decided to rename it first (because I wanted insurance against a oops moment). New name, pureFTPD_renamed.

Over phpmyadmin, they create a new database, load the data and drop the old database. This is the process for renaming. So, when the new database got created, that got replicated over because it wasn’t on the exclude list. The following SELECT statements would not work on the salve as the original database was excluded!

This caused the slave to stop and someone had to point out this simple fact for me to realise it. So, if you are replicating a server with more than one database and have excludes or includes for replication, please do take care and plan it for all servers. Also, make sure the slaves have the necessary rights for the operations.