Connection String to connect to mysql setup under

2019-08-19 12:39发布

问题:

Hihi, I have setup an Ubuntu instance in Amazon EC2, and I have setup MySQL under Ubuntu. Would like to ask, how can I connect my external asp.net application to this MySQL database? What should be the connection look like?

I am using Entity Framework 4. Thanks in advance!

回答1:

Have figured out the connection string format as follow:

<add name="ejabberdEntities" connectionString="metadata=res://*/ejabberdDB.csdl|res://*/ejabberdDB.ssdl|res://*/ejabberdDB.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=ec2-xx-xx-xxx-xx.compute-x.amazonaws.com;User Id=dbuser;Password=dbpassword;database=ejabberdDB;Port=3306;Persist Security Info=True&quot;" providerName="System.Data.EntityClient" />

:)