Notes on a "Database Server Error" after migrating Typecho to a new server
Machine-translated (anthropic, claude-haiku-5-5) from the Chinese original. Read the original in 中文
This problem appeared when I first migrated the blog. It was originally installed on shared hosting, and now it needs to be moved to a VPS with a LAMP environment. Following the usual stack, I installed PHP 7.0, MySQL, Apache, and other supporting software.
After importing the database and website files as usual and changing the database connection settings, I checked that the site was resolving correctly. When I opened the site, an unexpected error occurred: "Database Server Error". I was certain the database and files were not at fault, so I suspected that the database version or the PHP version was causing the problem.
I searched and found a related article, which mentioned that Typecho does not support PHP 7.0, and that the database engine needed to be changed to Pdo_Mysql.

We need to edit the database connection file config.inc.php in the Typecho root directory, changing Mysql to Pdo_Mysql at the position shown in the image above. Then check whether everything works normally.
In the end, after making this change, the problem was resolved.
Comments