Unable to connect to any of the specified MySQL hosts

Status
Not open for further replies.

tbc123

New Member
Messages
2
Reaction score
0
Points
0
Can anyone help please. I use the following .net code to connect to MySql database

using MySql.Data.MySqlClient;
MySqlConnection Conn = new MySqlConnection("server=localhost;Database=tbc_database;userid=tbc_user;password=xxxxxx;pooling=false");

Conn.Open();
MySqlCommand cmdEdit = new MySqlCommand(StrSql, Conn);
MySqlDataAdapter adptEdit = new MySqlDataAdapter(cmdEdit);
DataSet dsEdit = new DataSet();
cmdEdit.CommandType = CommandType.Text;
cmdEdit.ExecuteNonQuery();
adptEdit.Fill(dsEdit, "Dev");

It works on the development mashine, but can't connect to the database when page is on the server
I've tryed all possible connection strings like"server=mysql.x10hosting;Database=tbc_database;userid=tbc_user;password=xxxxxx;pooling=false"
added remote host as %.x10hosting.com.
All I get is "Unable to connect to any of the specified MySQL hosts" :eek4:
 

jtwhite

Community Advocate
Community Support
Messages
1,381
Reaction score
30
Points
0
I don't know much about .net and I highly recommend PHP but it looks like you have a syntax error here:

Code:
MySqlConnection Conn = new MySqlConnection("server=localhost;Database=tbc_dat abase;userid=tbc_user;password=xxxxxx;pooling=[COLOR="Red"][B][U]fals e[/U][/B][/COLOR]");

Maybe fix the misspelling?

added remote host as %.x10hosting.com.

Free hosting doesn't allow remote MySQL database access.
 
Last edited:

tbc123

New Member
Messages
2
Reaction score
0
Points
0
Sorry, typing error, the code is correct on the page:

"server=localhost;Database=tbc_database;userid=tbc_user;password=xxxxx;pooling=false"

So is it possible to connect to MySql from .Net for free?
Edit:
Still not working. Is it something to do with MySql.Data.dll ?

I've copied it into bin folder and
put reference using MySql.Data.MySqlClient in the code

Does anybody use the .NET here?
 
Last edited:
Status
Not open for further replies.
Top