How to connect ASP.NET to MySQL with MySQL Connect/Net

Databases > MySQL
If your application is using database, you might get following error when publish to server:

Unable to find the requested .Net Framework Data Provider.  It may not be installed.

There are 3 ways to fix this problem. 

1) Upload your own Mysql.Data.DLL from your computer C:\Program Files\MySQL\MySQL Connector Net x.x.x\Assemblies  to your hosting account's BIN folder.  

2) If you can't find your own MysqlData.DLL,  then you can use our server's default MySQL Connector

Edit your web.config, define Data Provider, you may refer the code below, which is based on MySQL .NET connector V6.6.4.0

Note: you may need to modify the code according to your app requirement.
    <compilation debug="true" urlLinePragmas="true">
        <add assembly="MySql.Data,Version=, Culture=neutral,PublicKeyToken=C5687FC88969C44D"/>
            <remove invariant="MySql.Data.MySqlClient"/>        
        <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"    type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>

3) If you are using the EF connection string and got the below error message.
"Error: The specified store provider cannot be found in the configuration, or is not valid."
Please refer to below steps to fix it.
1>Install MySQL.Data with NuGET, take public token from web.cofig.
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />

2>write it to .edmx file:
<Schema Namespace="mekashrontvModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="b77a5c561934e089"/>