Unable to connect to the database problem(using localhost)

Joomla versions 2.5, 1.7 and 1.6 are all end-of-life since December 31st 2014 and are no longer supported. Please use Joomla 3.x instead.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
ojslayout
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Wed Apr 15, 2015 7:31 am

Unable to connect to the database problem(using localhost)

Post by ojslayout » Mon May 04, 2015 3:05 am

Edit: Mods please move this to joomla 1.5 section.

So I tried to export our working joomla site to my localhost(WAMP). The php version that wamp(localhost/my pc) uses is php 5.5.12. Our joomla website uses joomla 1.5.26 and php 5.2.9. I created localhost database and import the sql files there. My database name at my localhost is the same with our database name of our website.

I change the configuration to this:

Code: Select all

var $host = 'localhost';
	var $user = 'root';  
	var $db = 'db_name';
I even tried a separate connection php file to check if it will connect. And it connected

Code: Select all

$db_host="localhost";
$db_name="db_name";
$username="root";
$pw="";

$db_con=mysql_connect($db_host,$username);
$connection_string=mysql_select_db($db_name);
mysql_connect($db_host,$username) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($db_name);

    
 $sql2="SELECT * FROM jos_fabrik_groups   ";
$result2=mysql_query($sql2);
while($row2=mysql_fetch_array($result2))
   {
 echo "a";
   } 
But why is that when I tried to open our exported website to my localhost(my pc) it says Database Error: Unable to connect to the database:Could not connect to MySQLDatabase?

My export process is I use ftp to transfer my website files to localhost.Using phpmyadmin on my cpanel, I export the sql files. I then import the sql files to my localhost mysql using mysql command.

ojslayout
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Wed Apr 15, 2015 7:31 am

Re: Unable to connect to the database problem(using localhos

Post by ojslayout » Mon May 04, 2015 5:04 am

Resolved. I am looking at the password variable, and it's only now that I notice it's quite below. I just leave it blank.


Locked

Return to “Installation Joomla! 2.5”