Answered by:
MySQL Host Not Allowed Access

Question
-
public void Button1_Click(System.Object sender, System.EventArgs e){MySqlConnection conn;//connect to DBconn = new MySqlConnection();conn.ConnectionString = "server=SERVER-NAME; user id=DATABASE-ID; password=DATABASE-PASSWORD; database=DATABASE-NAME";try{conn.Open();}catch (MySqlException myerror){MessageBox.Show("An Error Occured: " + myerror.Message);}}I'm getting an error message when connecting to MySQL database, the code is above, seems fine, but when connecting here's the error message given.An Error Occurred: Host 'MY-HOST-NAME' is not allowed to connect to this MySQL Server.I think the problems occurring on the mysql side?Thursday, December 17, 2009 4:26 PM
Answers
-
The MySQL server only allows connections from localhost by default.
See this article on how to enable remote connections.
Geert van Horrik - CatenaLogic
Visit my blog: http://blog.catenalogic.com
Looking for a way to deploy your updates to all your clients? Try Updater!Friday, December 18, 2009 9:40 AM -
hi,www.connectionstrings.com /// Please refer this site for connection string parametersPlease check the below site for sample---------------------------------------------hope this helped...
Narayanan Dayalan - Zeetaa Business Solutions ------- Please "Mark As Answer", if my answer works well with ur QueryFriday, December 18, 2009 10:41 AM -
access the files ??? which files your talking about ??? App.config ??if that is app.config, then use the below code, may be it needs port number to get connected...App.config------------<?xml version="1.0" encoding="utf-8" ?><configuration><appSettings><add key="variableSettings" value="Namespace.Class, Assembly "/></appSettings><connectionStrings><add name="MySQLCon" connectionString="Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;" providerName="MySql.Data.MySqlClient"/></connectionStrings></configuration>C# code - to get the connection string from app.config-----------------------------------------------------------------------string cnString = ConfigurationManager.ConnectionStrings["MySQLCon"].ConnectionString;hope this helps....
Narayanan Dayalan - Zeetaa Business Solutions ------- Please "Mark As Answer", if my answer works well with ur QueryMonday, December 21, 2009 5:04 AM
All replies
-
The MySQL server only allows connections from localhost by default.
See this article on how to enable remote connections.
Geert van Horrik - CatenaLogic
Visit my blog: http://blog.catenalogic.com
Looking for a way to deploy your updates to all your clients? Try Updater!Friday, December 18, 2009 9:40 AM -
hi,www.connectionstrings.com /// Please refer this site for connection string parametersPlease check the below site for sample---------------------------------------------hope this helped...
Narayanan Dayalan - Zeetaa Business Solutions ------- Please "Mark As Answer", if my answer works well with ur QueryFriday, December 18, 2009 10:41 AM -
thanks!but, i'm unsure on how to access the files that you have to modify?Friday, December 18, 2009 6:33 PM
-
access the files ??? which files your talking about ??? App.config ??if that is app.config, then use the below code, may be it needs port number to get connected...App.config------------<?xml version="1.0" encoding="utf-8" ?><configuration><appSettings><add key="variableSettings" value="Namespace.Class, Assembly "/></appSettings><connectionStrings><add name="MySQLCon" connectionString="Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;" providerName="MySql.Data.MySqlClient"/></connectionStrings></configuration>C# code - to get the connection string from app.config-----------------------------------------------------------------------string cnString = ConfigurationManager.ConnectionStrings["MySQLCon"].ConnectionString;hope this helps....
Narayanan Dayalan - Zeetaa Business Solutions ------- Please "Mark As Answer", if my answer works well with ur QueryMonday, December 21, 2009 5:04 AM