0

After hosting, i get this error:"Can't connect to MySQL server on 'localhost' (10061)"
The code was working fine in my computer.
I have hosted it in windows platform and i am using mysql and php.
Here is my code for db connection

$connection = mysql_connect(localhost,uname,pword) or die (mysql_error());

        $db = mysql_select_db($databaseName, $connection);
        if (!$db) {
            print "error selecting db--" . mysql_error() . "--" ;
        }

Any help will be appreciated.

Edited by mike_2000_17: Fixed formatting

4
Contributors
7
Replies
9
Views
7 Years
Discussion Span
Last Post by pritaeas
0

10061 means connection refused. Are you sure mysql is running ? Perhaps a firewall won't let you connect. It can be a number of things.

0

Yes mysql is running. And i have created tables but get errors when i try to access them from the website.

0

Hello Anony

Other possible reason to error would be different password.
Is it same on your pc & from website?
Is the database named correctly??

Edited by Ezzaral: Snipped "fake sig" link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

0

Yes the password is correct. i can access it using phpmyadmin. Is it because of user privileges??

0

User priveledges don't stop users connecting.
has the php-mysql setup completed correctly?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.