Could not connect to database
Posted by: hedera (---.lightspeed.sntcca.sbcglobal.net)
Date: November 20, 2013 01:26AM

I've installed WampServer 2.2 on Win7 Pro 64 bit, on my Lenovo laptop. I use it for development copies of web sites, including a Joomla 1.5 site which I want to upgrade to Joomla 3. I can't get the Joomla 1.5 site to come up, even though I've followed all the procedures I wrote down which worked last time (including instructions from Joomla doc).

My Wampserver has to listen on port 8080 because IIS listens on port 80. I've made the changes in httpd.conf and the log shows apache listening on port 8080. I've copied the files over and created a new database using the name, db user and password from my old site. I try to bring up the site and get this error:

Database Error: Unable to connect to the database:Could not connect to database

All the Joomla doc says if you get this error it's an issue with these fields in configuration.php:

var $host = 'localhost'; // usually "localhost". If it's different for your server then your hosting provider should be able to tell you that.
var $user = 'the_db_username';
var $db = 'the_databasename';
var $password = 'the_db_password';
var $live_site = ''; // is usually empty.

I formerly used Wampserver 2 on my old laptop and never had a problem.

hedera
=======
Nature bats last.

Options: ReplyQuote
Re: Could not connect to database
Posted by: RiggsFolly (---.as13285.net)
Date: November 20, 2013 06:12PM

Have you defined 'locahost' in your hosts file?

Its not pre-defined, it is something you have to do so windows knows where the 'localhost' domain is i.e. which ip address to go to.

edit c:\windows\system32\drivers\etc\hosts

make sure you have these entries in there

127.0.0.1  localhost
::1  localhost





HOW TO EDIT THE HOSTS FILE
The hosts file is protected by windows, in order to save it you must have Administrator privilages.
Vista/W7/W8 You may think you are an Administrator BUT YOU ARE NOT.

To successfully save the hosts file do this to launch your editor with Admin Privilages.

Locate your editors icon on the desktop or from the Start menus ( notepad will do if you have nothing else )
left click + shift over your chosen editor icon - will show a menu.
select "Run As Administrator" from the menu.
Navigate your editor to the c:\windows\system32\drivers\etc\hosts file.

When you have made changes you will now be allowed to save them.

Options: ReplyQuote
Re: Could not connect to database
Posted by: hedera (---.lightspeed.sntcca.sbcglobal.net)
Date: November 21, 2013 12:40AM

This works, thanks, I can now connect, but I have other problems. Will open a separate ticket.

Options: ReplyQuote


Sorry, only registered users may post in this forum.