Reputation: 117
Attempting to connect to a remote (GoDaddy) MySQL database I have created under a domain I own. I am using c#, and not php.
The IP address in the web.config is provided by GoDaddy in Plesk.
Receiving the following error:
MySql.Data.MySqlClient.MySqlException: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near '[UserProfile]([UserId] int NOT NULL
PRIMARY KEY IDENTITY, [Email] nvarchar(56) N' at line 1
This is my web.config (and associated connection string):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off" />
</system.web>
<system.data>
</system.data>
<connectionStrings>
<add connectionString="Server=50.62.209.107;Port=3306;Database=RP;Uid=my_userid;Pwd=my_password" name="RP" providerName="MySql.Data.MySqlClient"></add>
<add connectionString="Server=localhost;Port=3306;Database=RP;Uid=my_userid;Pwd=my_password" name="RP_Local" providerName="MySql.Data.MySqlClient"></add>
</connectionStrings>
<appSettings>
<add key="enableSimpleMembership" value="true" />
</appSettings>
</configuration>
I am able to use those same parameters in MySQL Workbench and access the database with no problem.
Any help appreciated. Thanks!
Upvotes: 2
Views: 698
Reputation: 251
Try this
<add name="connstring" connectionString="server=localhost;User Id=root;Persist Security Info=True;database=marctest;password=PASSWORD" providerName="MySql.Data.MySqlClient"/>
Upvotes: 1