How to Restore Old MySQL Databases to New XAMPP Installation?
Summary: You may need to restore old MySQL databases to new XAMPP installation when migrating or upgrading to new XAMPP server version. This post explains the step-by-step procedure to restore the old MySQL databases to new XAMPP installation. It also mentions a specialized MySQL repair tool that can come in handy if your MySQL database gets corrupted.
You usually need to install a new server when you’re facing issues with your existing installation or when you’re upgrading to a higher version. Whatever be the case, you need to also restore databases from old server to the new server. So, if you’re using XAMPP with MySQL and installed a new server and need to restore old MySQL databases to new XAMPP installation, then read this post. Here, we will discuss the methods with stepwise instructions to restore MySQL databases to a new XAMPP installation.
Methods to Restore MySQL Database to New XAMPP Installation
If you’ve backup of the database, then you can use PhpMyAdmin utility in your XAMPP server to restore the database. However, if PhpMyAdmin fails to restore the database, then you can use backup directories to restore the database. Below, we will discuss these methods in detail.
Method 1: Use PhpMyAdmin to Restore the Database
If you’ve an updated backup of MySQL database, you can use PhpMyAdmin to restore the database to new XAMPP server. You can access the PhpMyAdmin utility only from the same host that XAMPP is running on http://localhost Follow the steps given below to restore database using PhpMyAdmin:
- Open a web browser on your system and enter http://localhost/phpmyadmin to open phpMyAdmin.
- Login to the phpMyAdmin.
- Once the PhpMyAdmin cPanel appears, click the Import option.
- Click ‘Choose File’ to select the database backup file on your local system.
- After selecting the file, choose SQL from the Format dropdown menu and then click Import.
- Wait for the import process to complete. Once the process is complete, you can see a success message.
- You can check the restored database in the list of databases in the PhpMyAdmin.
Now, you can export the restored database to the new XAMPP server to access it. To export the database, follow the same steps but instead of Import, click the Export option.
Method 2: Use Backup Directories to Restore MySQL Databases
PhpMyAdmin may fail to restore MySQL database when there is some issue with the backup database file (it is corrupted or in incorrect format). In such a case, you can use directories to restore the MySQL database manually. In this method, you need to copy the MySQL database from the Backup Directories to the new location. Here are the steps to restore old MySQL databases to new XAMPP installation using Directories:
- First, locate your old XAMPP installation folder and then save the MySQL folder/Backup folder and their files and directories in a different folder.
- Next, install the new XAMPP server.
- Once XAMPP is installed correctly, stop the XAMPP control panel. To do this, go to List of Services (next to Module) and click on Stop on Apache and MySQL.
- Now, copy the data folder (saved above in a different folder).
Note: The data folder contains all the MySQL files (data file and log file) that you need to restore your database.
- Make sure you copy the databases instead of the default databases.
- Now, paste the copied data into your new XAMPP installation folder.
- Restart the services from the XAMPP Control Panel.
What if you Fail to Restore the MySQL Database?
You may fail to restore the old MySQL databases or encounter issues after restoring the databases, if the database files are corrupted, damaged, or inaccessible. In such a case, you need to repair the corrupted/damaged MySQL database. For this, the best option is to use an advanced MySQL database repair tool, like Stellar Repair for MySQL. With this tool, you can repair the corrupt MySQL databases and restore all the data quickly and efficiently. It can repair corrupt InnoDB and MyISAM tables of the MySQL database. It helps restore all the database objects, including primary keys, triggers, etc., with complete integrity.
With this advanced MySQL repair software, you can:
- Repair MySQL database created in InnoDB/MyISAM engine with complete precision.
- Recover all the data from damaged, corrupt, or encrypted MySQL database with 100% integrity.
- Save the recovered data in a new MySQL file and other formats, such as MariaDB, SQL Script, CSV, HTML, and XLS.
- See the preview of recoverable elements in MySQL database before saving.
- Repair corrupt/damaged partitioned tables.
Conclusion
Above, we’ve explained the methods to restore old MySQL databases to new XAMPP installation. You can import MySQL database from the backup file using PhpMyAdmin or use the backup directories to restore the databases manually. If the database is corrupted or damaged, then you can repair it using Stellar Repair for MySQL. It is a specialized MySQL database repair tool that can repair database created in MyISAM or InnoDB and recover all the data while preserving the original table structure and formatting. The tool supports MySQL versions 8.0.36 and lower, including MariaDB up to 11.3.2.