Link to home
Start Free TrialLog in
Avatar of k1ss0ff
k1ss0ff

asked on

MySQL connection failure on deployment

Hi there

I've got an asp.net application which I've deployed to my shared hosting provider.  I've modified the connection string to point to the MySQL database stored on the shared server, and the page loads correctly.


However, when I run the page through the internet (as opposed to through VWD2008), I get an error: Unable to connect to any of the specified MySQL hosts.

I'm not sure where I've gone wrong.  The MySql.Data.dll; MySql.Data.Entity.dll and MySql.Web.dll are all in the /Bin folder.


I feel like I'm finally on the cusp of getting my app working!

Thanks in advance
Avatar of Shinesh Premrajan
Shinesh Premrajan
Flag of India image

It could be possible that there is some user restrictions, check the user privileges.
flush the user privileges.

go to the command prompt and type mysql

mysql -h hostname -u username@ipaddress -p password

See if you are able to login ?
Avatar of k1ss0ff
k1ss0ff

ASKER

I can login from my local machine and use the application when running on localhost, it's the connection through the website that's failing?
SOLUTION
Avatar of JohnHE
JohnHE
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of k1ss0ff

ASKER

Hmm...

My hosting company uses myphpadmin to manage the MySQL databases.  As part of the set up, I had to create a database account which logged me into myphpadmin, where I ran the script to create the database on the server.

I've now plugged in the username/password etc. that I used to create the database into my connection string, and have managed to connect to the database on the server, whilst running the asp app on my localhost. So i don't think it's a problem with the user account, but rather with the ASP application or something missing from it?

K1ss0ff, you could very well be correct, but could you to log into phpmyadmin, click on the "databases" tab.  Click the link for your database, and then click on the privileges tab.  The page that loads should provide a list of users that have access to that database.  On that page, you should see your user listed one or more times depending upon the number of hosts that user has permission to connect to that database from.  What host(s) are shown on that page?
Could you pls post the connection string here, so that we can help you out easily
Avatar of k1ss0ff

ASKER

The users of the database managed through my host's web interface rather than through myphpadmin, so this is what I see (attached)


<connectionStrings>
		<remove name="LocalMySqlServer"/>
		<add name="LocalMySqlServer" connectionString="Server=91.208.99.2;Port=3365;Database=passenge1_nreservices;Uid=passenge1_root;Pwd=123456;" providerName="MySql.Data.MySqlClient"/>
	</connectionStrings>

Open in new window

privileges.jpg
Uid=myUsername@91.208.99.2;

Give a try on this
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not completely sure, but it seems like my theory that the database connection was being refused because the host you were trying to connect to it from wasn't assigned to the database user was correct.  If nothing else, it should have brought to light the fact that the wrong host IP address was being used.
Not completely sure, but it seems like my theory that the database connection was being refused because the host you were trying to connect to it from wasn't assigned to the database user was correct.  If nothing else, it should have brought to light the fact that the wrong host IP address was being used.