Avatar of tangteng78
tangteng78
Flag for Malaysia asked on

How to connect to external data server on MySQL using .NET?

Hi,
I want to separate my database to be in a separate data server. Below is the current connection string on my local database (it's a working one).
<add name="MySqlConn" connectionString="Database=kudodb;Data Source=localhost;User Id=root;Password=root;charset=utf8" providerName="System.Data.MySql"/>

I'd tried on below and it's not working (xxx.xx.xx.xx = data server ip address).
<add name="MySqlConn" connectionString="Database=kudodb;Data Source=xxx.xx.xx.xx,3306;User Id=root;Password=root;charset=utf8" providerName="System.Data.MySql"/>

Any idea? Do i need to set permission also on the MySQL database?
ASP.NETMySQL Server

Avatar of undefined
Last Comment
Umesh

8/22/2022 - Mon
tangteng78

ASKER
And i get the error message below on the connection string below:
 <add name="MySqlConn" connectionString="Database=kudodb;Data Source=xxx.xx.xx.xx; Port =3306;User Id=root;Password=root;charset=utf8" providerName="System.Data.MySql"/>
============
 Error Message:
============
Access denied for user 'root'@'pgxpletang.abc.com' (using password: YES) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Access denied for user 'root'@'pgxpletang.abc.com' (using password: YES)
 
Umesh

Error simply states that password supplied for user root is not matching with that of stored in grant tables...

Pls create a user account on the MySQL server..
ASKER CERTIFIED SOLUTION
Umesh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Umesh

Did you try?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck