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.

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.

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

Hello Anony

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

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

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

yes it was setup correctly.

Check the config file for phpMyAdmin. Perhaps it is using a different port.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.