cannot connect to the MySQL database

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
5/15/2010 7:15:56 AM
Gravatar
Total Posts 1

cannot connect to the MySQL database

Problems connection to db. Help would be deeply appreciated.

Thks.

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Dns.GetHostEntry(String hostNameOrAddress) at MySql.Data.Common.StreamCreator.GetHostEntry(String hostname) at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) at MySql.Data.MySqlClient.NativeDriver.Open() The action that failed was: Demand The type of the first permission that failed was: System.Net.DnsPermission The first permission that failed was: The demand was for: The granted set of the failing assembly was: The assembly or AppDomain that failed was: MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d The method that caused the failure was: System.Net.IPHostEntry GetHostEntry(System.String) The Zone of the assembly that failed was: Internet The Url of the assembly that failed was: file:///C:/work_ms/mojo/wwwroot/bin/MySql.Data.DLL --- End of inner exception stack trace --- at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at mojoPortal.Data.DBPortal.DatabaseHelperGetConnectionError(String overrideConnectionInfo)

 

OS: Windows 7 professional

mojoPortal: 2.3.4.3

DB:

C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin.exe Ver 8.42 Distrib 5.1.46, for Win32 on ia32
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 5.1.46-community
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306

5/17/2010 5:55:55 AM
Gravatar
Total Posts 18439

Re: cannot connect to the MySQL database

Hi,

It is strange that it is throwing a security exception when trying to do a DNS lookup. Is your machine part of a domain where restrictive group policy settings might be pushed down to your machine? Possibly a restrictive .NET trust policy has been pushed down to your machine.

You might try change localhost to 127.0.0.1 in your connection string, maybe that would bypass the dns lookup.

Hope it helps,

Joe

6/11/2010 2:05:23 AM
Gravatar
Total Posts 19

Re: cannot connect to the MySQL database

Hi there,

I am trying to use mojo with MySQL for the first time. I have downloaded and installed the mojoportal mysql connector and the dot.net mysql data provider.

However when I run setup I get the same error as above (and below).

I have set up a test project using mysql and dotnet and a grid loads from the database just fine. I was using port 1443, but I am not sure if mojo picks up the port number, I guess it would just pass the whole connection string to the dotnet provider, but have changed that to use port 3306 which is the default. I can use mojo with SQL Server with no problem on the same machine. Have switched from localhost to 127.0.0.1 but that didn't help.

Any ideas Joe/anybody else?

Thanks

Matt

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Dns.GetHostEntry(String hostNameOrAddress) at MySql.Data.Common.StreamCreator.GetHostEntry(String hostname) at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) at MySql.Data.MySqlClient.NativeDriver.Open() The action that failed was: Demand The type of the first permission that failed was: System.Net.DnsPermission The first permission that failed was: The demand was for: The granted set of the failing assembly was: The assembly or AppDomain that failed was: MySql.Data, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d The method that caused the failure was: System.Net.IPHostEntry GetHostEntry(System.String) The Zone of the assembly that failed was: Internet The Url of the assembly that failed was: file:///C:/inetpub/wwwroot/Mojo2343/bin/MySql.Data.DLL --- End of inner exception stack trace --- at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at mojoPortal.Data.DBPortal.DatabaseHelperGetConnectionError(String overrideConnectionInfo)

6/12/2010 1:34:34 PM
Gravatar
Total Posts 18439

Re: cannot connect to the MySQL database

Hi Matt,

Looks like you get a permissions error trying to do the dns lookup on the host name for your mysql server. I'm not sure what is locking that down, possibly group policy if your machine is a domain member. You might try using the ip address of the mysql server instead of the host name.

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.