MySQL Connection errors

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.
3/13/2009 5:16:33 PM
Gravatar
Total Posts 20

MySQL Connection errors

operating system? - Win
database platform? - MySQL
version of mojoPortal? - Current Release

 

I am having some trouble with the MySQL connection strings for ASP.net.  I am getting error message (see below), but I am not sure where I am defining my driver, do I need to specify a port? This is a medium trust environment and I have followed the directions for setting up the environment for medium trust.

<add key="MySqlConnectionString" value="Data Source=;Database=;User ID=;Password=;Charset=utf8;" />

Any suggestions would be appreciated.  Not sure where to turn next....

 

File system permissions ok. The system cannot connect to the MySQL database. Please check your connection string.
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.SocketPermission, 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.Sockets.Socket.CheckCacheRemote(EndPoint& remoteEP, Boolean isOverwrite) at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state) at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state) at MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) 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.SocketPermission The Zone of the assembly that failed was: MyComputer --- 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)
 

3/14/2009 7:42:10 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

Hi,

This error seems very clear "Unable to connect to any of the specified MySQL hosts", so either you don't have the server name correct in your connection string or it can't resolve the ip address for the hostname,  or the db server is refusing connections. MySql has very specific permissions based on which machine is connecting to it. If the db is on the same machine as the web, just put localhost for the server name.

If this is on your own machines, I also recommend MySql 5.0 rather than 5.1 which seems to have major bugs.

Hope it helps,

Joe

3/14/2009 10:24:05 AM
Gravatar
Total Posts 20

Re: MySQL Connection errors

 

Joe, Thanks for the note back. I had originally tried implementing the user.config connection string, so I went back and used the web.config only.  That ended up letting it go through.  I will have to trace down why that did not work at a later date.  In the meantime, I got the following error in the automated script (setup/default.aspx).   Can you help me understand what might have gone wrong and what I need to do to fix it and then restart the process? Thank you.

Probing system...
File system permissions ok.
MySQL database connection ok.
database permissions are sufficient to alter schema.
database initial schema needs to be created.
Running script mojoportal-core - 2.2.7.8 - 00:00:00.1718750
Running script mojoportal-core - 2.2.7.9 - 00:00:01.2500000
Running script mojoportal-core - 2.2.8.0 - 00:00:01.2968750
Running script mojoportal-core - 2.2.8.1 - 00:00:01.2968750
Running script mojoportal-core - 2.2.8.2 - 00:00:01.2968750
Running script mojoportal-core - 2.2.8.3 - 00:00:01.3125000
Running script mojoportal-core - 2.2.8.4 - 00:00:01.3125000
Running script mojoportal-core - 2.2.8.5 - 00:00:02.2187500
Running script mojoportal-core - 2.2.8.6 - 00:00:02.2968750
Running script mojoportal-core - 2.2.8.7 - 00:00:02.3437500
Running script mojoportal-core - 2.2.8.8 - 00:00:02.3437500
Running script mojoportal-core - 2.2.8.9 - 00:00:02.3593750
Running script mojoportal-core - 2.2.9.0 - 00:00:02.5781250
Running script mojoportal-core - 2.2.9.1 - 00:00:02.8906250
Running script mojoportal-core - 2.2.9.2 - 00:00:02.9062500
Creating site with default settings... - 00:00:03.1406250
Creating roles and admin user... - 00:00:47.5000000

An Error Occurred:The type initializer for 'mojoPortal.Web.Framework.CryptoHelper' threw an exception.
Source:mojoPortal.Web.Framework
Stack Trace at mojoPortal.Web.Framework.CryptoHelper.Hash(String cleanText) at mojoPortal.Web.mojoMembershipProvider.EncodePassword(String pass, MembershipPasswordFormat passwordFormat) at mojoPortal.Web.mojoMembershipProvider.EncodePassword(String pass, SiteSettings site) at mojoPortal.Web.mojoSetup.CreateRequiredRolesAndAdminUser(SiteSettings site) at mojoPortal.Web.UI.Pages.SetupHome.CreateSiteAndAdminUser() at mojoPortal.Web.UI.Pages.SetupHome.RunSetup() at mojoPortal.Web.UI.Pages.SetupHome.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

3/14/2009 10:36:30 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

Hi,

This problem seems to be happening to some users with Medium Trust installations. I have a solution to prevent this problem for the next release.

For the current release I think you could work past it if you add this to Web.config:

<add key="InitialSitePasswordFormat" value="0" />

then you will need to clean out all objects from the db and then visit /Setup/Default.aspx again.

This will make the initial password format clear text and avoid calling the crypto helper when it creates the admin user. I think this error is preventing the creation of the admin user.

Hope it helps,

Joe

3/16/2009 3:40:09 PM
Gravatar
Total Posts 20

Re: MySQL Connection errors

Joe,

I wanted to follow-up and close the loop on this topic.  I followed the changes you suggested by adding the additional code and I took the connection string information out of the user.config file and kept it in the web.config file.  That allowed me to set up the db.

Incidently, I inadvertently deleted the "home" page on the new installation copy.  Is there away to get it back?  It is not in the table (mp_pages) but when I try to create a new home it errors out.

Brian

3/17/2009 7:36:31 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

Hi Brian,

What error happens when you try to re-create it?

visit Admini Menu > System Log, clear the log then try to re-create the page then post any error in the log.

Hope it helps,

Joe 

3/18/2009 3:01:37 PM
Gravatar
Total Posts 20

Re: MySQL Connection errors

Joe,

Regarding the error I am getting when deleting pages... Can you help me decode this...?  Also this is really not an installation issue anymore. When we get this resolved, I will open a new string if I have another question.  Thank you.

Brian

Server Error in '/' Application.
--------------------------------------------------------------------------------

You can't specify target table 'mp_pages' for update in FROM clause
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: You can't specify target table 'mp_pages' for update in FROM clause

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[MySqlException (0x80004005): You can't specify target table 'mp_pages' for update in FROM clause]
MySql.Data.MySqlClient.MySqlStream.OpenPacket() +238
MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId) +60
MySql.Data.MySqlClient.MySqlDataReader.GetResultSet() +49
MySql.Data.MySqlClient.MySqlDataReader.NextResult() +722
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +878
MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() +43
MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(MySqlConnection connection, String commandText, MySqlParameter[] commandParameters) +120
MySql.Data.MySqlClient.MySqlHelper.ExecuteNonQuery(String connectionString, String commandText, MySqlParameter[] parms) +80
mojoPortal.Data.DBPageSettings.CleanupOrphans() +122
mojoPortal.Business.PageSettings.DeletePage(Int32 pageId) +17
mojoPortal.Web.AdminUI.PageProperties.btnDelete_Click(Object sender, EventArgs e) +54
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


 

3/19/2009 8:41:45 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

This seems a bug. I'm investigating it now and will post a fix asap.

Best,

Joe 

3/19/2009 8:55:15 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

What version of MySql are you using. The syntax seems to be supported in my version 5.0

Best,

Joe 

3/19/2009 9:00:52 AM
Gravatar
Total Posts 20

Re: MySQL Connection errors

I am using a MySQL 4 db.

Basically, I get that error if I use the delete pages functionality.  It appears to break the link and delete the page, but it does not remove the link from the menus.  If you then click on the links on the menus it then takes you to the home page.

If you want me to send you a direct link to the site I am running this on, let me know what e-mail address outside of the forums to send it to.

Thank you for your assistance.

Brian

3/19/2009 9:09:18 AM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

Hi,

I just emailed you a replacement for mojoPortal.Data.dll, can you let me know if it solves the problem?

After installing it touch your Web.config to be sure the app is recycled.

Thanks,

Joe 

3/19/2009 1:57:12 PM
Gravatar
Total Posts 18439

Re: MySQL Connection errors

Brian reported back to me by email that the updated dll I sent fixed the problem for him.

I have update the download for the MySql Data layer so if anyone else has this issue they can download it again to get the fix. It was a syntax compatibility problem with MySql 4.x, the syntax has been fixed to be compatible. Users of MySql 5.0 don't need to worry about it because the previous syntax worked fine in MySql 5.0.

Thanks,

Joe

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