Hi

I am using C# to connect to mysql database that install in my local machine.After I complete the project I want to publish it in another server.So I change the mysql connection string.Here I mention the
connection string that I used in local machine

String MyConString = "SERVER=localhost;"+"DATABASE=IPG;"+"UID=root;"+"PASSWORD=Test;";

Before publich into server,I change connection string as below

String MyConString = "SERVER=10.2.0.212;"+"DATABASE=IPG;"+"UID=root;"+"PASSWORD=Test;";

But that time its not connect to database.I use IP adreess instead of localhost.Please help me.

Thanks

Recommended Answers

All 2 Replies

Hi

I am using C# to connect to mysql database that install in my local machine.After I complete the project I want to publish it in another server.So I change the mysql connection string.Here I mention the
connection string that I used in local machine

String MyConString = "SERVER=localhost;"+"DATABASE=IPG;"+"UID=root;"+"PASSWORD=Test;";

Before publich into server,I change connection string as below

String MyConString = "SERVER=10.2.0.212;"+"DATABASE=IPG;"+"UID=root;"+"PASSWORD=Test;";

But that time its not connect to database.I use IP adreess instead of localhost.Please help me.

Thanks

Hi,
You need to create the global user account on mysql as follows.

CREATE USER 'monty'@'localhost' IDENTIFIED BY 'Test';

GRANT ALL PRIVILEGES ON *.* TO '<Username>'@'%' WITH GRANT OPTION;

After that set the connection string with this username and password. It will work. Otherwise let me know.

Hi

Thanks murugave184,its working now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.