Jump to content

[Answered] Error 500 To Connect Mysql Host.


jetliweb

Recommended Posts

Hi,

 

Looks like I can not connect to the MySQL database of my account, don't know why?

I use the ASP.net in C# to connect it. So far I just put the codes to connect to database to show the data,

but the page shows this error "

 

Server Error in '/' Application

Unable to connect to any of the specified MySQL hosts.

 

Description: HTTP 500. Error processing request.

Stack Trace:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.

at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x00000] in <filename unknown>:0

"

 

My codes:

//use MySql database

using MySql.Data.MySqlClient;

protected void BTN_conMysql2_Click(object sender, EventArgs e)

{

string MyConString = "SERVER=localhost;" +

"DATABASE=mydatabase;" +

"UID=myusername;" +

"PASSWORD=mypassword;";

string sql = "select * from report";

DataSet dt =new DataSet();

 

MySqlConnection connection = new MySqlConnection(MyConString);

MySqlDataAdapter adapter = new MySqlDataAdapter();

adapter.SelectCommand = new MySqlCommand(sql, connection);

adapter.Fill(dt);

 

GridView_dataFromMysql.DataSource = dt;

GridView_dataFromMysql.DataBind();

}

 

It actually worked at the very beginning, but it doesn't recently. ?

Link to comment
Share on other sites

I don't know much in C# and ASP.

 

Check whether the General Configurations Like Host name is 'localhost ' not any other name and the user name and password are correct and the user has permission to check the DB.

 

wait for a while till some one with ASP or C# knowledge helps you.

 

And Welcome to Helio Net Community. :)

Link to comment
Share on other sites

Hi,

 

Looks like I can not connect to the MySQL database of my account, don't know why?

I use the ASP.net in C# to connect it. So far I just put the codes to connect to the database to show the data,

but the page shows this error "

 

Server Error in '/' Application

Unable to connect to any of the specified MySQL hosts.

 

Description: HTTP 500. Error processing request.

Stack Trace:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts.

at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0x00000] in <filename unknown>:0

at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x00000] in <filename unknown>:0

"

My codes:

//use MySql database

using MySql.Data.MySqlClient;

protected void BTN_conMysql2_Click(object sender, EventArgs e)

{

string MyConString = "SERVER=localhost;" +

"DATABASE=mydatabase;" +

"UID=myusername;" +

"PASSWORD=mypassword;";

string sql = "select * from report";

DataSet dt =new DataSet();

 

MySqlConnection connection = new MySqlConnection(MyConString);

MySqlDataAdapter adapter = new MySqlDataAdapter();

adapter.SelectCommand = new MySqlCommand(sql, connection);

adapter.Fill(dt);

 

GridView_dataFromMysql.DataSource = dt;

GridView_dataFromMysql.DataBind();

}

 

It's working on my local (I created same enviroments on my local and helio localhost).

It actually worked at the very beginning, but it doesn't recently.? Should set up something else?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...