Skip to content

Frequently Asked Questions (FAQ) Commonly Seen Error

adriancs edited this page Mar 13, 2024 · 12 revisions
  1. Cannot connect to website database. An exception Occur: Unable to connect to any of the specified MySQL hosts.
  2. MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime.
  3. How do I get notified if there is new release?
  4. Connection Timeout Error - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
  5. Error - Packets larger than {"max_allowed_packet"} are not allowed.
  6. Pre-compiled or NuGet package is not signed. Can I get a signed version of DLL of MySqlBackup.NET?
  7. Unicode characters are not shown properly
  8. How to add this library into my project? What is the recommended way?
  9. Out of memory exception
  10. Table or Column's name wrapped with double quotes in stead of single quote

1. Cannot connect to website database. An exception Occur: Unable to connect to any of the specified MySQL hosts

By default, MySql at web hosting will only allow connection from localhost. If you wish to connect to MySql using your computer (remote access), or other IP, you have to allow the MySql at your website to be connected by the specific IP (your IP). If the website is using CPanel, you may refer this guide:

2. MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime

This is not a bug. It is an expected behaviour. MySQL allow zero date time which means 0 year 0 month and 0 days, but in .NET world's concept, there is no such 0 year, 0 month and 0 day. The minimum possible date in .NET is 01-01-01. (Commonly occur when data type of DATE (not DATETIME) used in one of the table).

There are 2 ways to resolve this:

1st, by adding allowzerodatetime in the MySQL connection string (Recommended if you use MySqlBackup). Example:

server=localhost;user=root;pwd=qwerty;database=test;allowzerodatetime=true;

2nd, by adding convertzerodatetime in MySQL connection string. Example:

server=localhost;user=root;pwd=qwerty;database=test;convertzerodatetime=true;

Using convertzerodatetime will convert null date in MySQL into DateTime.MinValue (0001-01-01 00:00:00) in .NET Language.

3. How do I get notified if there is new release?

Choose Watching for this project at the top right corner. You will be notified for any changes.

4. Connection Timeout Error - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

The default connection time of MySqlConnection is 15 seconds. You can extend it to a longer time. For example:

server=localhost;user=root;pwd=1234;database=test;*timeout=120;

Read More: http://dev.mysql.com/doc/refman/5.6/en/connector-net-connection-options.html

5. Error - Packets larger than max_allowed_packet are not allowed.

Read more >> Error - Packets larger than max_allowed_packet are not allowed

6. Pre-compiled or NuGet package is not signed. Can I get a signed version of DLL of MySqlBackup.NET?

In stead of signing MySqlBackup.NET, why not just include the source code directly into your project. MySqlBackup.Net is all written in C#. It is not a very large and complicated project. It can be simply just add all the source code into your project directly.

Or if you still need a signed MySqlBackup.NET, just recompile the project and sign it to your flavor.

7. Unicode characters are not shown properly

Example of unicode characters:

  • Western European specific languages, the character of 'À', 'ë', 'õ', 'Ñ'.
  • Russian, Hebrew, India, Arabic, Chinese, Korean, Japanese characters, etc

MySqlBackup.NET stands on top of MySql.Data.DLL. MySql.Data.DLL only handles well with unicode characters in UTF8.

The solution is use UTF8 encoding database.

Here is a showcase that explained why UTF8 is the solution for storing unicode characters:
https://nicj.net/mysql-converting-an-incorrect-latin1-column-to-utf8/

8. How to add this library into my project? What is the recommended way?

Read more: https://github.com/MySqlBackupNET/MySqlBackup.Net/wiki/How-to-Add-This-Library-into-Your-Project

9. Out of memory exception

At the app.config, add the following:

<configuration>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
  </runtime>
</configuration>

Read more about "gcAllowVeryLargeObjects - Microsoft .NET Documentation"

10. Table or Column's name wrapped with double quotes in stead of single quote

Read More: https://github.com/MySqlBackupNET/MySqlBackup.Net/wiki/Table-or-Column's-name-wrapped-with-double-quotes-in-stead-of-single-quote

Clone this wiki locally