-
Notifications
You must be signed in to change notification settings - Fork 106
Frequently Asked Questions (FAQ) Commonly Seen Error
- Cannot connect to website database. An exception Occur: Unable to connect to any of the specified MySQL hosts.
- MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime.
- How do I get notified if there is new release?
- Connection Timeout Error - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
- Error - Packets larger than {"max_allowed_packet"} are not allowed.
- Pre-compiled or NuGet package is not signed. Can I get a signed version of DLL of MySqlBackup.NET?
- Unicode characters are not shown properly
- How to add this library into my project? What is the recommended way?
- Out of memory exception
- 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:
- http://docs.cpanel.net/twiki/bin/view/11_30/CpanelDocs/RemoteMySQL
- http://support.hostgator.com/articles/cpanel/how-to-whitelist-your-ip-in-cpanel-for-remote-mysql-access
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.
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
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.
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/
Read more: https://github.com/MySqlBackupNET/MySqlBackup.Net/wiki/How-to-Add-This-Library-into-Your-Project
At the app.config, add the following:
<configuration>
<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>
</configuration>
Read more about "gcAllowVeryLargeObjects - Microsoft .NET Documentation"