0

I have been trying to use Entity Framework to connect to a MySQL database, database first, but I can´t get any connection to the database. When searching google and mysql.com, I only get guides thats telling me to use code first or model first.

What I want is what I always do: Add new Entity Data Model, write the credentials to the database and then, everything works just fine and I can write my LINQ queries as I am used to.

I am using Windows 8, VS 2013 ultimate, Environment.Version is 4.0.30319.36366.

How can I connect to MySQL with EF database first?

enter image description here

6
  • you need to post your code in question instead of image link. Thanks Commented Apr 7, 2017 at 7:19
  • when exactly you are getting this error ? Similar type question is already available, please check if it helps stackoverflow.com/questions/18060667/… Commented Apr 7, 2017 at 7:26
  • The error says that the SQL Server is not accessible. EF code generator is not able to connect to the database server. Did you verify that if you are able to the database server from Sql Management Studio from the machine where your code is ? Commented Apr 7, 2017 at 7:30
  • There is no code to show, I am adding a new Item to my project: ADO.NET Entity Data Model -> EF Designer from database -> clicking Next button -> New Connection -> Here Im filling in Server name, User name and Password. Against a "normal" database, this is all I need to do. Commented Apr 7, 2017 at 7:42
  • Yes, I can acces the database by doing the following: download some nuget packages (I have downloaded a lot of them now so I don´t know which is the correct), and write 3 lines of code 1. "var conn = new MySqlConnection();", 2. conn.Connectionstring = ".....", 3. conn.Open(). That works which means I have the correct credentials. Commented Apr 7, 2017 at 7:45

1 Answer 1

1

enter image description hereThat's a common error when you first load the EF Designer. I don't know if its the same in VS 2013 but In VS 2015 You can create a new connection and select MySQL, but MySQL For Visual Studio should be properly installed.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank your for reply, however, this is something I have already tried. The MySQL Database option does not appear in my Visual Studio. Any suggestions?
Try to reinstall the MySQL For Visual Studio Also please read this stackoverflow.com/questions/16879451/… It might help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.