Download all Joomla templates including quickstart (demo)only $24.99

Blog

how to recover database in localhost

Recover MySQL databases from frm, ibd, myd myi on localhost

Recovering databases on localhost is an extremely complicated task because it is difficult to know why our databases just disappear.

In Windows and WampServer it has happened to us many times that due to screens of death, forced windows updates, a power outage or some strange reason, when entering localhost our development sites showed 500 errors and when accessing PHPMyadmin they were just some tables from our databases. If this is happening to you, the first thing is to stay calm and check if the database files exist.

That is not an official guide or a rule, it is the way we have recovered using LOGIC. In this guide we are going to recover more than 100 databases from Joomla sites that were hosted on WampServer with Mysql 5.7.23, for which we will use the logic of returning to the previous state by reinstalling the version of MySQL that was in use, and the combination of existing configuration files, This LOGIC can be applied in XAMPP, Uniform Server or another, clearly the process would be different for each one.

1. File review

Check if your database files exist, to do this go to where you have WampServer installed: H:\wamp64\bin\mysql\mysql5.7.23\data\YOUR_DATABASE_NAME and inside the folder check if there are files with extension .frm, .ibd, .MYD, .MYI, there must be files for each of the tables in your database. For each table there must be a .frm file and an .ibd or .frm, .MYD and .MYI. If these files are present follow the other instructions, otherwise this guide is not for you.

2. Checking Versions

Check the version of WampServer and MySQL that you were using, for which you must run the program and click on the icon, write down those versions. Additionally, look for the files with which you installed both WampServer and MySQL for Wamp, these files will be very important because remember that our logic is to return to the version that was working. If you do not have these files you can try downloading the latest updates of the same versions.

3. Making Backup

Make a full copy of the Wamp installation (the wamp64 folder) on another disk (It will only be used to copy files as needed). It is true this can be too much or take hours, but it is better to be safe than sorry, because if something goes wrong you can lose absolutely everything and cry while it takes you weeks or months to redo everything.

4. Reinstalling WampServer

Run WampServer if the icon turns green or yellow you don't need to reinstall, otherwise follow the instructions below because WampServer doesn't let you do a fresh install over an existing one.

  1. Close WampServer: Right click on the WampServer icon and then Exit.
  2. Go to the disk where you had installed Wamp: H/ and change the name of the folder from wamp64 to wamp645 or another.
  3. Install the same version of WampServer on the same Disk (H/) this will create a new folder wamp64
  4. When the installation finishes, cut all the files from the wamp64 folder and paste in the wamp645 folder, replacing the existing files, then proceed to delete the wamp64 folder, which should be empty, and finally change the name of wamp645 to wamp64. If when running WampServer again the icon comes to see or yellow, this has been recovered well.

5. Reinstalling Mysql

Again you must close WampServer and you must have the installer of the same version of Mysql that you are using, if you never downloaded and installed it separately, you can download this from https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Addons/Mysql/

  1. We go to H:\wamp64\bin\mysql and change the name from mysql5.7.23 to mysql5.7.233 or another.
  2. We run the Mysql installer (in this case wampserver3_x64_addon_mysql5.7.23.exe), that will create a new folder mysql5.7.23
  3. We cut all the content of the new mysql5.7.23 and paste it in mysql5.7.233 replacing the existing files, then we delete the mysql5.7.23 folder that should be empty, and finally we change the name of mysql5.7.233 to mysql5.7.23.
  4. We will recover the previous configuration of mysql5.7.23 for which we go to our backup J:\wamp64\bin\mysql\mysql5.7.23\data and copy the mysql, performance_schema, sys folders, and the auto.cnf files , ib_buffer_pool, ib_logfile0, ib_logfile1, ibdata1, YOUR_COMPUTER_NAME.err files, then we paste it replacing the existing ones in the same path of our WampServer installation H:\wamp64\bin\mysql\mysql5.7.23\data. If the previous configuration files of mysql5.7.23 and the files of your databases were not damaged, you should already have your databases back and you can access them from PHPMyadmin or the console to continue working on your project or export them in SQL files to import them in MySQL 8.0

 Important

Mysql works in a unique and different way, that is why you cannot copy the database files from one version of mysql to another, not even in the same version, that is why it is important to recover the original configuration and files that were running before the disaster.

85,603+
Happy customers guarantee our Templates and Extensions