Connecting WAMP to live database post image

Connecting WAMP to live database

Posted on:

So when you are making a Joomla or WordPress site or any with php script you would usually have some kind of server program running on your computer to test it before uploading the site to a live domain name. For this i use WAMP. I used to use XAMPP but it broke so switched to WAMP.

Lets say you finish the site, upload the files from your WAMP folder www, and export you database and put it on your live database and all is fine. Then the client wants a new page or some changes done. So you download all the files to your www folder but instead of logging into your hosting and exporting the live database and importing it to your localhost you want to just connect to it from your www folder on your compute. So that’s –

local files ….. connecting to live database ….. previewing changes at localhost/sitename

So you can make changes to your site without editing the live sites files, just in-case you mess it up and people are looking.

One error i always get when doing this is –
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

Now I sat for about four hours trying to change this so called old style password but it just didn’t work. I think it might be a live server issue rather than something I can change on my localhost. So the easiest solution I could find was to add a password to my localhost and downgrade my WAMP php and Apache versions.

On thing to note is that your WAMP must be installed in the C:\ drive or somewhere where there is no spaces in the path name. C:\Program Files\ wont work.

If you go to localhost phpmyadmin and do an sql statement.

UPDATE mysql.user SET password=password("newpassword") WHERE user="root";
Flush Privileges;

Now go to C:\wamp\apps\phpmyadmin3.4.9\ and in this file find the line below and add in your new password. Mine was the word password (easy to remember)

$cfg['Servers'][$i]['password'] = 'password';


Left click on your WAMP logo in the task bar, go to php, version, get more…

Do the same for Apache.

Php version 5.2.11 and Apache version 2.0.63 are compatible and run together for me. If they aren’t listed on WAMP’s extensions you can go to

Download them. Stop and exit WAMP. Double click the dowloaded  installers and run them both. When WAMP starts up again, go to php, versions, and click 5.2.11, and the same with Apache choosing 2.0.63.

You might need to Stop All Services and Start them again but the WAMP logo should go green and you will be able to connect to a remote database without having to set up a local database or change any configuration files.