Errors when using PetaPoco with MySql drivers

While using PetaPoco with MySql I was getting these obscure errors that were causing the Micro ORM not to function. The reason was that PetaPoco is not built to natively use MySql and therefore requires additional configuration in order to work.

Typical errors that you will see are :

    Keyword not supported: ‘port’.

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

Completely useless in diagnosing the actual issue… well at least I found them useless. Smile

The solution I discovered was to add three items of configuration. Firstly add “providerName” to your connection string:

<add name="TestConnection" connectionString="Server=localhost;Port=3306;Database=sakila;User ID=xxx;Password=xxx;" providerName="MySql.Data.MySqlClient" />

Secondly add a section to your configuration file (app.config or web.config):

      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>

Lastly add a reference to MySql.Data.Entities. You can get it here on Nuget.
That’s it! PetaPoco will now happily use MySql!
Explore posts in the same categories: Development

Tags: ,

You can comment below, or link to this permanent URL from your own site.

5 Comments on “Errors when using PetaPoco with MySql drivers”

  1. Langit Biru Says:

    I’m facing the same problem

    thanks a lot…

  2. MG Says:

    Thanks for this info dionscher. I’ve revisited this page a few times now to use it.

  3. carlospc1970 Says:

    You have saved me days of frustration. Thanks man!!!!

  4. asdf Says:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: