Adsense Deluxe, WordPress 2.5 and MySQL 5.0

Part of the issue the other day, when this site was a little more than broken, was that I had made the switch from a MySQL 4.0 database to a MySQL 5.0 database. You wouldn’t think that would be an issue. Well, that would be a wrong assumption.

First, I use a plugin called Adsense Deluxe. I’m sure that many of you might as well. It’s kind of a old thing that I implemented and don’t actively use now, but it’s still there in some of the old posts. If it breaks, the implementation simply reverts to a few comments here and there. Again, not a problem.

Again, wrong assumption. There’s something in the way that MySQL 5.0 runs the queries that causes an issue with the empty array handling that worked fine in MySQL 4.0. I’m no expert on MySQL, so I wasn’t able to figure out exactly what the problem was. What I do know is that rather than just breaking and being just comments, it became some very ugly MySQL error lines at the beginning of each and every page and post. Not very nice at all. All made worse by the fact that the plugin hasn’t been updated for at least two versions of WordPress. The fact that it works at all is probably a miracle.

Another issue that I ran into was that suddenly, the front page of this site was starting at the beginning of the posts (in this case August 24, 2005) and working it’s way up. So when I told it to show the 5 most recent posts, it showed the first 5. I changed the orderby and order settings in the call and it still did the same thing. A little research on the codex gave me a answer. There is an issue in one of the early versions of MySQL 5.0 that causes the database calls for the posts in WordPress to break and default to the first x posts. The fix? Update MySQL. No workaround.

So, with the both of the errors making the site pretty much unusable, I had only one option. Revert the database to a older version or update it to a newer version. Since there wasn’t a newer version, I had to reinitialize a new database as a MySQL 4.0 database and wipe the old database. This takes a little bit of time, but really isn’t more than a 30 minute job. What took the time, was the 2-3 hours it took for me to reach that conclusion.

Now that it’s all back on MySQL 4.0, the recent posts show like they are supposed to. Adsense Deluxe works like it’s supposed to. And all is happy here in thatedeguy land. Until the next update anyways…

About Shane Ede

Shane Ede is an IT guy by day and a Entrepreneurial Blogger by night. You can follow him here on Thatedeguy or over on Twitter and Google+.


  1. Switching between MySQL versions is definitely a major pain. I remember about 2 months ago when my host upgraded the servers I had some HUGE issues with a lot of my scripts failing, and this wasn’t even on WordPress. You need to always make sure to hold a backup so if things go sour, you have an exit plan.

  2. I regularly back my db up – when my host upgraded to MySQL 5.0 I had some things break as well. Luckily, I knew someone who was able to hand-edit my SQL dump and re-import it. Backup every time you fill your gas tank.

  3. I regularly move my projects between various servers, which often have different versions of software tools. I encountered a problem moving data from MySQL 5 to MySQL 4. The issue here is 4 cannot directly import files dumped by 5. You must use the –compatible=mysql40 flag. However, that does not export the “autoincrement” option on tables that are autoincremented, so re-importing the data will fail.