.Net Core MySql

18,084

Solution 1

At the time of this question (Mar 2016) there was no .NET Core-compatible ADO.NET provider for MySQL.

Now situation is changed:

  • MySqlConnector written by Bradley Grainger -- licensed under MIT, and offers full async support
  • MySql.Data (>6.10) provided by Oracle (traditionally, GPL)

Personally I prefer MySqlConnector -- it can be used in commercial projects for free (MIT license); also I've tested it with my NReco.Data library under Linux, and it works perfectly in my scenarious. Unfortunately, MySqlConnector doesn't support EF Core yet.

--- UPDATE --

One more .NET Core-compatible MySQL connector + EF Core MySQL provider:

Solution 2

UPDATE 2

MySql Connector NET for .NET Core 1.0 was just released (Sep 2016)
http://insidemysql.com/mysql-connector-net-for-net-core-1-0/

I didn't try Bradley Grainger's connector, but this one from MySQL do not support SSL. :(

So, anybody who wants to use anyway, should connect with ";SslMode=None;" in the connection string.

Share:
18,084
rasmus91
Author by

rasmus91

Started using Linux in October 2007, a few days after the release of Ubuntu 7.10 Gutsy Gibbon. I've worked in an Microsoft Partner ERP business as a sysadmin, and developer of admin/dev tools. Currently I am studying Software Engineering at a university.

Updated on June 18, 2022

Comments

  • rasmus91
    rasmus91 almost 2 years

    I've just started coding in Visual Studio Code with .NET Core, on Ubuntu 14.04.4 I'm used to both using Ubuntu (from personal interests, hobby, etc) and .NET and Visual Studio at work.

    But I've run into a problem i can't seem to overcome. I'm building a small console app that i want to communicate with a MySql Server, but I can't seem to get the MySql.ConnectorNET.Data working properly.

    It was installed with the command dnu install MySql.ConnectorNET.Data And that seemed to work fine. The dependency was added in the project.json file, and intellisense was able to traverse the package just fine, but the OmniSharp Log reports that:

    [INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Project /home/<username>/VSCode/SimpleSQLatmpt/project.json has these unresolved references: MySql.ConnectorNET.Data
    

    and I simply can't seem to fix that. VSCode seems to detect it, and asks me to run the dnu restore command. But it's to no avail. For all intends and purposes it seems like MySql.ConnectorNET.Data is available in the project, but just can't be used.

    Can any one tell me how to fix this? And just as important, why it is happening in the first place?

    Thank you very much for your time.

  • rasmus91
    rasmus91 over 7 years
    Well, i like using the Official connectors, but no SSL is a bit of a deal breaker.
  • Bradley Grainger
    Bradley Grainger over 7 years
    We just added SSL support in v0.3.0 of MySqlConnector: github.com/mysql-net/MySqlConnector nuget.org/packages/MySqlConnector
  • Muhammad Ummar
    Muhammad Ummar almost 7 years
    MySql.Data.Core doesn't exist anymore. Please see nuget.org/packages/MySql.Data.Core
  • Vitaliy Fedorchenko
    Vitaliy Fedorchenko almost 7 years
    @MuhammadUmmar you're right MySql.Data.Core was deprecated and now net-core compatible build is available for MySql.Data package (I've updated the link).
  • Himalaya Garg
    Himalaya Garg over 5 years
    MySql.Data from Oracle also not supporting SSL as of now :(