Having problems connecting to MySql DB on host.using mojoportal-2-3-7-6-aspnet35

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
1/10/2012 6:48:14 AM
Gravatar
Total Posts 40

Having problems connecting to MySql DB on host.using mojoportal-2-3-7-6-aspnet35

I've moved my site to my web host but have hit a snag. Setup says it can't connect to the database.

I've checked the connection string, its correct in both web config and user config and they are both right. but the error the setup page gives me:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) at MySql.Data.MySqlClient.NativeDriver.Open() --- End of inner exception stack trace --- at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.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)

any ideas?

Is there something I forgot to do for medium trust?

1/10/2012 6:55:35 AM
Gravatar
Total Posts 18439

Re: Having problems connecting to MySql DB on host.using mojoportal-2-3-7-6-aspnet35

Hi,

Using MySql in medium trust can be a problem, but the error doesn't look like a medium trust issue, it just can't connect. You should ask your host for help because it appears that the database server is not accessible from the web server, possibly blocked by the firewall.

Hope that helps,

Joe

1/11/2012 5:14:37 AM
Gravatar
Total Posts 40

Re: Having problems connecting to MySql DB on host.using mojoportal-2-3-7-6-aspnet35

One odd thing I noticed: was that when I exported my database as SQL files it lower cased all the table names so mp_ForumThreads became mp_forumthreads. This caused an issue for me because when I went to run the SQL statements to reinsert my data I would be told table mp_forumthreads doesn't exist. However, the website was running fine on my development box with the lower-cased table names.

So when I exported the database and let it make the Drop and Create Statements too then I end up with twice as many tables the only difference being the casing used in the table names. I wasn't aware that table names were case sensitive in databases. I tried exporting the data using both SQLyog's Community Edition and Quest Software's TOAD for MySql but both lower cased the table names, and I couldn't find a setting that would allow it to keep the original casing of the table names.

Any advice for next time?

1/11/2012 9:07:47 AM
Gravatar
Total Posts 18439

Re: Having problems connecting to MySql DB on host.using mojoportal-2-3-7-6-aspnet35

Hi,

The lower casing of table names happens depending on server configuration. On Linux the file system (and thus table names) is case sensitive but on Windows it is not, so typcially (but not always) MySql on Windows is configured to force lower case table names by default. I don't believe the tools for exporting and importing control that, it is controlled by settings chosen when installing MySql. The export tools just export them as they are named in the db.

Now that your table names are lower case I don't think you will have any further troubles because they will stay that way when you export or import them again as long as you make your sql dump include both structure and data, it should be easy to restore it on another MySql server. Though if you currently have both mixed case and lower case copies, you will probably need to verify it is actually using the lower case ones and then delete the mixed case ones otherwise it may export both.

Hope that helps,

Joe

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