0
votes

I have an ASP.NET MVC4 site using EF 5.0 and MySQL for the db. Everything works great on my development PC, yet when I make a build of the site for my Windows 2008 Web Server SP2, with IIS7, I get the following error...

Access denied for user 'root'@'::1' (using password: NO)

Now, what is baffling here is this problem is fixed by providing a password in the connection string (which I have), so I have no idea why I would still get this error.

My connection string in my web.config is:

metadata=res:///MyModel.csdl|res:///MyModel.ssdl|res://*/MyModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;password=1234;persist security info=True;port=3307;database=MyDb"

2

2 Answers

0
votes

Try changing your connection string to

metadata=res:///MyModel.csdl|res:///MyModel.ssdl|res://*/MyModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;password=1234;persist security info=True;port=3307;database=MyDb"

Your connectin string had no closing "

0
votes

I managed to resolve this... strangely, 'localhost' works for regular MySQL connections to the database (I use it in ASP.NET websites without EF).

But now using EF, it seems specifically putting 127.0.0.1 as the server instead of localhost fixes the issue.

Very strange indeed!