I just migrated a site from one server to another using cpanel's migration tool. Since then, the xenforo installation has this problem while many other mysql based php applications seem to work just fine. At first I thought it had something to do with the database name/username details, then port number etc... Seems the config.php file is correct down to the port number. As to why I'm seeing this error is still a mystery.