12 steps to rebuild your WAMP server without losing your data

Like many people, I have a WAMP server on my laptop where I mock up new websites and run private websites as internal Wikipedia.

I am currently running WAMP 2.2 and it fails – a lot – three times in six months.  I have no idea why and each time the symptoms are different.

But I do know what the solution looks like. I need to restore long enough to be able to gain access to my database and back up anything that is not backed up and to set any unusual settings to defaults so I can think about an alternative.  But first I must restore WAMP without losing my website files (www) and the databases which are stored in bin.

Here are the steps.

Step 1 Backup your WAMP folder

Simply copy your WAMP folder into C:/ .  Windows will keep it as Wamp – Copy.

Have a break and calm down. This might take an hour or so depending on how much is in your database bin and www folders.

Step 2 Print out your passwords and permissions

Try to recall your user, host, password table.  If you can log in to phpmyadmin, you will find it there under users.  If your can access your mysql console, open it; ignore the password; and type

Select user, host from mysql.user;

The table will show you your usernames and hosts but not your passwords.

Note well that if you are an organized person, this is a table that you might want to keep on hand for emergency purposes.  But right now we will proceed assuming that we cannot quite recall what we did when we set up WAMP.

Write down what you can remember and do it now before you start guessing and create chaos later.

Step 3 Print out all the files that you might have edited when you set up WAMP

  1.  wamp/apps/phpmyadminVerNo/config.inc.php (this is where you put your user name and password and where you might have set up authentication and ports)
  2. /wamp/wampmanager.tpl (you might have changed http://localhost to http://localhost:81 if you have changed the port for apache from 80 to 81  three places)
  3. /wamp/bin/apache/apacheVerNo/conf/httpd.conf (if you changed the above, you will also have changed Listen 80 to Listen 81 and localhost:80 to localhost:81)
  4. /wamp/bin/mysql/mysqlVerNo/my.ini (you might have changed the port for myql from 3306 to 3307 – three places)
  5. /wamp/scripts/testport (where you might have changed 80 to 81 in several places)
  6. /wamp/lang/English (where you might have change Port 80 to Port 81)

Also write down the Version Numbers for Apache, MySQL and Phpmyadmin.

Check whether your computer is 64 bit or 32 bit.

You are now ready to start restoring WAMP.

Step 4 Download the correct version of WAMP

Find WAMPSERVER on the internet  and download the correct version of WAMPSERVER.  Don’t be tempted to upgrade while you are restoring.  Keep the task manageable.

Step 5 Uninstall WAMP

Go to your Control Panel (from Start) and uninstall WAMP.  Uninstall removes everything except your www and bin folders.

Step 6 Install the correct version of WAMP

Install WAMP.  I use all of the defaults (IE and dummy email).  If I need to fix my email, I do it in a separate exercise.

REMEMBER to enable the rewrite module in Apache. Go to the WAMP menu, Apache, modules.  Click on rewrite. And close. Then check again. Sometimes the “tick” doesn’t stick.   If you don’t enable rewrite, your websites will not be able to read “pretty urls” that you carefully set up for humans to read and you will get baffling errors.

Step 7 Let WAMP start

When WAMP asks, let it start itself up.  You will see the icon in your bottom tool bar and it should go GREEN.

Step 8 Check you have access to localhost

Got the WAMP menu and check you have access to localhost – that is the list of your websites in www.

If your config.inc.php file shows a password (see Step 3), then you don’t have access to Phpmyadmin – fix that in the next step.

Step 9 Fix your password in config.php.inc so you have access to phpmyadmin

Got to your config.inc.php file (see Step 3). If it differs in format from the one you printed out, then you have installed the wrong version of WAMP. Close all services, exit and start again!

If you have the correct version, then change your user name and password. If you have changed your ports, then do nothing else right now.

Stop all services and restart all services (from the WAMP menu).

Check you have access to phpmyadmin.  If you get a pink error message #2002 or #1045, then in all likelihood, you have put in the user name and password incorrectly.  But sometimes you have little choice but to try to reinstall (start again).  In short, at this point, you should have access to Phpmyadmin and clerical error or confused working procedures is a more likely cause of failure than anything more complicated (Don’t google  it. That is like looking for medical information – you will just panic. Calm down and work systematically.)

If you have access to phpmyadmin, you should be able to access your user table.

Steps 10 & 11 Access a website

Now go to localhost and access a website. If you did not change your ports, everything should work fine.  All done.

If you did change your ports, you have one of two options.  Change the port settings on your websites to match the defaults.  Or, carry on and edit all the files that you printed in Step 3.

To change the port settings in Drupal, the port setting for mysql is in /www/sites/all/default/settings.php. You have to go to Properties with a right click and change from read-only. Change the port to the default of 3306.  Save and set the Properties back to read-only.  Remember you will have to do this for every website.  Also remember if you test this on one website and then go on to change the port settings, come back to change the port setting to the new number.

If you have edited all the files in Step 3,  then this time stop all services, exit and restart WAMP and then all services because you have edited the menu as well as the services you call.

If all goes well, you should be able to access all your websites.

Step 12 Consider changing your server

WAMPSERVER 2.2 seems unstable to me. I don’t know if 2.4 is anybetter.  What I do know is that the config.inc.php file in WAMPSERVER 2.4 is radically different from the one in 2.2 and I cannot see how to update the ports.

Also the version of mysql is different which requires an undate of your data tables as well as your software. To upgrade, you might do better to treat the job as a migration and back up all your websites and all your mysql, rebuild your server and then rebuild your websites.

 

There you go –it might take you an hour to get back into action. If anything goes wrong, it might take several hours. But don’t panic.  The web is littered with half instructions and panicky notes.  Don’t go near them.  Just work very systematically. Check as you go so that you don’t cause more chaos. And everything will work.

Similar Posts:

6 Comments

  1. I noticed in my taskmanager that apache had 2 processes running. If I stopped one localhost came up immediately. So I found the file and deleted it. So wampmanager went orange.
    Should I follow your steps in reconstituting wamp so I don’t damage mysite tables in my joomla instsllation?

  2. Hello. I followed all of the steps, and it only lets me into PHPMyAdmin when I don’t put my password into the config.inc.php file. it also says “No Privileges” when I click on the Users tab. when I go to http://localhost/wordpress/ it says “error establishing a database connection”

    also, my username and my website doesn’t come up under the database tables. I’m not so sure what I did wrong. (I’m using wampserver 2.5, apache 2.4.9, PHP 5.5.12, and MySQL 5.6.17) and I was reinstalling because Wamp stopped working on me.

    it wanted me to reinstall wordpress everytime i logged in, and when i tried to visit my local site it said “error establishing a database connection”

    fortunately I have a backup of the www folder from when all was working and life was good. but sadly I didn’t copy the entire wamp folder until i followed your steps. so I have a copy of the site on an external hard drive before i uninstalled it and followed the steps here.

    please help me! I feel like I’ve tried everything, and I have a lot of work invested on the site. (again, the www folder has been copied when it did work.) what would you recommend I do??? thanks!!

    1. alright, so I changed my username back to “root” in config.inc.php file, and now I have access to Users again. and it looks like all my other files are there as well. unfortunately, my site still doesn’t seem to be establishing a database connection.

  3. Thank you! I can meet now my deadline thanks to this tutorial.
    I have ventured to develop several WordPress sites using Wamp with a lot of success but i must confess that when errors challenge me i have no real knowledge to rely on.
    I followed every step and could solve it until the green icon, but after this all my sites wanted to (re)install wordpress from the beginning. After figuring out a little I solved this last trouble pasting de folder “bin/mysql5.6.17/data” from the backup (step1) into the new folder installation.
    The ordered, logical process you suggest is the highlight of this tutorial and helped me reach the solution.
    Have a great day! Mine is now thanks to you 🙂

Leave A Comment

Your email address will not be published. Required fields are marked *