I had an issue with a clients WordPress website recently where their old host server died taking their website with it.
The old server was a Windows box running PHP & MySQL. The client has since gone with a new host which runs on a Linux box with PHP & MySQL. Problem being we didn’t have a backup of the
sql from the database, just the raw database files.
I had access to a backup of the old box but didn’t have access to phpMyAdmin or any tools as such to secure a sql backup of the files. I had a copy of the
ib_logfile0 / ib_logfile1 files and the
.frm files from the database.
.frm files create the tables within each database but don’t contain any data. It’s the
ib_logfiles that contain that data.
I set up a fresh XAMPP install on a windows machine. Opened up phpMyAdmin locally and created a database with the same name as it existed on the old server and then killed the Apache & MySQL services.
I then went to
c:\xampp\mysql\data\<dbname> and copied over all the
.frm files into that directory. This gave my new database the structure it once had. I then went to
c:\xampp\mysql\data and copied over the
ibdata1 file and the
Started apache and MySQL services but the MySQL service wouldn’t start. Strange.
Some gentle prodding and scanning of the error logs suggested that the
ib_logfile sizes didn’t correspond with the
my.ini config file. I checked my file sizes and a quick google revealed that I need ed to change something in my
my.ini file.I opened the
my.ini file, found the line
innodb_log_file_size. I put my file size into this handy converter and changed
innodb_log_file_size to the size of my new logfiles.
Booted up Apache & MySQL service again and success!, it started. I then headed into the local phpMyAdmin and lo-and-behold, my database and data was all in tact!
Nearly there. I installed a fresh install of WordPress on the new host.
I quickly exported the data as
.sql from my local database, deleted the new WP tables on the new hosts database and uploaded my newly exported
.sql file and hoorah, a fully working WordPress website.
One happy and relieved client and one happy and relieved developer :)