WAMP server taking forever to connect to database

Hi

I’m using wamp server 2.0 and though phpmyadmin is working and phpinfo() shows mysqli and mysql I cannot establish a connection to mysql using the following script:


<?php
$link = mysqli_connect('localhost','root','*******');
echo = `Connection to database esetablished!`;
?>

When I execute the script the page just says loading and does not load no matter how long I wait.

Thanks for any help.

Thanks a lot Peterb and Sgtlegend, your scripts worked!

The assumption is that you are placing your files in the directory www and that your file type ending is .php as well.

You can try what SgtLegend says or this which is similar.


           $db_name = "test";
           $link = mysql_connect ("localhost","root","*****");
           if ($link && mysql_select_db ("$db_name"))
              return ($link);
           return (false);

Hi peterb

I’m experiencing the same problem either way.

Hello jack_storm,

Try replacing mysqli_connect with mysql_connect.

What happens if you use this

$link = mysql_connect('localhost','root','********');
if (!$link){
    die('Unable to connect to the MySQL server<br /><br />'.mysql_error());
}

echo 'Connection Successful';