MindTouch Developer Center > Deki > FAQ > Troubleshooting > How do I...Troubleshoot MySQL exceptions

How do I...Troubleshoot MySQL exceptions

  • We have highlighted your search term MySql.Data.MySqlClient for you. If you'd like to remove the search term, click here.

These are exceptions that you may get upon initially connecting to the wiki if your MySql server settings are incorrect. This may happen as many distros ship MySql with increased security by default.

Connection related exceptions
MySql.Data.MySqlClient.MySqlException: Connection unexpectedly terminated. 
at MySql.Data.MySqlClient.MySqlStream.LoadPacket () [0x00000] 
at MySql.Data.MySqlClient.MySqlStream.OpenPacket () [0x00000] 
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] 
at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] 
at MySql.Data.MySqlClient.MySqlPool..ctor (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] 
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] 
at MySql.Data.MySqlClient.MySqlConnection.Open (Boolean allowPooled) [0x00000]  

 

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Exception: Exception of type System.Exception was thrown. 
at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] --- End of innerexception stack trace --- 
at MySql.Data.MySqlClient.NativeDriver.Open() [0x00000] at MySql.Data.MySqlClient.Driver.Create(MySql.Data.MySqlClient.MySqlConnectionStringBuild er settings)[0x00000] 
at MySql.Data.MySqlClient.MySqlPool..ctor(MySql.Data.MySqlClient.MySqlConnectionStringBuild er settings)[0x00000] 
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySql.Data.MySqlClient.MySqlConnectionStringBuild er settings)[0x00000] 
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] 
Common solutions
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address            = 127.0.0.1

Be sure that line bind-address = 127.0.0.1 is commented out in your my.cnf file and restart mysql.

Be sure that skip-networking is not declared in your my.cnf file and that it's not a command line option either.

If you are running debian ensure that you have /etc/hosts.allow and /etc/hosts.deny setup to allow access to MySQL.  Debian builds their MySQL packages with TCPWrappers enable.    Alternatively, configure your connection string in mindtouch.deki.startup.xml to use the unix protocol rather tcp/socket. 

 

<db-options>pooling=true; Connection Timeout=5; Connection Lifetime=30; server=/var/run/mysqld/mysqld.sock; Protocol=unix; Min Pool Size=2; Max Pool Size=50; Connection Reset=false;character set=utf8;ProcedureCacheSize=25;Use
 Procedure Bodies=true;</db-options>
Forum posts
Missing stored procedures
MySql.Data.MySqlClient.MySqlException: PROCEDURE config_get_Config does not exist at MySql.Data.MySqlClient.MySqlStream.OpenPacket () [0x00000]
at MySql.Data.MySqlClient.NativeDriver.ReadResult (System.UInt64&affectedRows, System.Int64& lastInsertId) [0x00000] 
at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet () [0x00000] 
at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00000]

If you've migrated your data to a new database, be sure you copy the stored procedures as well.  The sprocs are located in web/maintenance/archives/sprocs-*.sql.

You should be able to apply the sprocs by running updateWiki.sh  

Syntax error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near... 

This is almost certainly a bug in the Deki Wiki code. Please post about it in the forums or submit a bug.

Time out overnight/after long idle

If you come back to your wiki after a long period of idle usage, you will get a 500 error, and then on reloading the page, it will work fine.  Checking deki-api.log gives you this error:

ERROR MindTouch.Data.DataCommand - Execute(Text: 'config_get_Config', Type: Stored Procedure)
MySql.Data.MySqlClient.MySqlException: Connection unexpectedly terminated.
  at MySql.Data.MySqlClient.MySqlStream.LoadPacket () [0x00000] 
  at MySql.Data.MySqlClient.MySqlStream.OpenPacket () [0x00000] 
  at MySql.Data.MySqlClient.NativeDriver.ReadResult (System.UInt64& affectedRows, System.Int64& lastInsertId) [0x00000] 
  at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet () [0x00000] 
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00000]  

This is a bug that is being worked on at present, and there are workarounds in the bug report.

Documentation
Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2