Jump to content

[Answered] Error 500 To Connect Mysql Host.


Recommended Posts

Posted

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. ?

Posted

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. :)

Posted

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?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...