Well, even if you keep your SMF forum updated regularly, you can’t avoid few weird things (Remember Murphy's Law?). I had a stint with such an error with SMF forum. When I navigate to my forum, it threw a Database Error. Not much information was available on that screen. I logged into the database to trace any errors (logged in smf_log_errors) using phpMyAdmin.
As I wrote in previous post, I did a repair of all the tables of SMF database, using phpMyAdmin. This fixed the problem as much to allow me to log into the forum and reach the Admin area.
SMF has given few tools for forum maintenance, as listed below:
Optimize all tables to improve performance.
Check all files against current versions.
Find and repair any errors.
Recount all forum totals and statistics.
Empty out unimportant logs.
Convert HTML-entities to UTF-8 characters
Before touching any of these, I prefer taking a backup. SMF Admin area provides a tool for that too in “Forum Maintenance - Backup Database” section. Please do take a backup; it helps in case the forum maintenance tools go insane.
After the backup, command “Find and repair any errors”. Hmm… here the story starts..It diagnosed an error and possible fix. Here it is …
Note: It appears that your database may require an upgrade. Your forum files are currently at version SMF 1.1.11, whereas your database is at version SMF 1.1.5. It is recommended that you execute the latest version of upgrade.php.
This happens as a result of improper upgrade of the forum software. On every patch release, the SMF update functionality provided in the SMF admin area can be executed to keep it up-to-date. This update script sometimes skips updating the mySQL database tables. Version to version, there could be some changes to the database tables. If such database updates are skipped or failed internally (Update doesn’t display these warnings/failures), it will leave the database in the old version and all other sources will get updated to latest release! Strange thing is, after the update, your forum is running smoothly … until a day, when you see “Database Error”. (Note: I don’t know the reason for Why it worked smoothly first?)
After digging through lot of posts/forums on net, I found a solution appreciated by many here. But, I was not lucky with that. It reported that “the sources and language files are not the latest ones”. Upon my continued search on net, I got a clue on how to fool this script not to throw the above said warning and somehow get on to forum maintenance. Well, its as simple as running the following SQL query.
UPDATE `smf_settings` SET `value`='1.1.11' WHERE `variable`='smfVersion' LIMIT 1;
Now, you should be able to do “Find and repair any errors”. This will do some helpful stuff. Then, do “Empty out unimportant logs”; this will cleanup the extraneous logs that add unnecessary weight on you database. And do a “Recount all forum totals & statistics”.
It should bring life back to your SMF forum.
Note: These are the steps followed by me as an immediate fix, to at least bring up my forum. So, I don’t know the actual cause of the error. Time & usage will tell us whether it has really worked. At the same time, I am scout for a good, clean & elegant forum software. I will keep you updated.