Jump to content


Photo

[Solved] Trouble with remote mySQL access

mysql database access remote access sql

  • Please log in to reply
6 replies to this topic

#1 jackt

jackt

    Newbie

  • Members
  • 3 posts

Posted 05 February 2018 - 02:54 PM

Hi 

I've been trying to make a windows desktop application with visual studio using C# and i'm having trouble connecting to the mySQL database. 
 
my connection string is "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=*******" (obviously password isn't *******)
 
the user ID has been added to the database and has been given all privileges.
I've added the wildcard "%" to the remote mySQL section to allow connections from all IP addresses. 
I've tried resetting the password and changing it in my code multiple times. 
It is 100% not the code because i have tested it using a different host and it worked.

// sql server connection here 
            string constring = "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=********";
            SqlConnection sqlcon = new SqlConnection(constring);
            try
            {
                sqlcon.Open();
                MessageBox.Show("sqlconnection successful");
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            finally
            {
                sqlcon.Close();
            }

i get the error "a network related or instance specific error occurred while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that the sql server is configured to allow remote connections." later in the error it says "the network path was not found". 

Any help would be greatly appreciated. 

 

Cheers 

Jack 



#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 18,932 posts
  • Gender:Male

Posted 05 February 2018 - 10:31 PM

Try using 64.62.211.131 as your host. The network path not found error makes me think maybe it's having trouble resolving the johnny.heliohost.org into a numerical IP. Also if that doesn't work can you post the full error messages rather than paraphrasing them?

#3 jackt

jackt

    Newbie

  • Members
  • 3 posts

Posted 06 February 2018 - 12:07 AM

I tried replacing the host with the IP you gave, but it gives the same error. 

See the attached image for the full error message. 

Thanks for your help 

Attached Files



#4 Luigi123

Luigi123

    Rank X Member

  • Moderators
  • 1,843 posts
  • Gender:Male
  • Location:Winnipeg, Manitoba, Canada

Posted 06 February 2018 - 03:07 AM

Moved to Customer Service.


Posted ImagePosted ImagePosted Image
Posted ImagePosted ImagePosted Image

#5 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 18,932 posts
  • Gender:Male

Posted 06 February 2018 - 04:16 AM

my connection string is "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=*******" (obviously password isn't *******)

Does it work if you put UID=jackt_un; instead of User ID=jackt_un; ?

#6 wolstech

wolstech

    Rank X Member

  • Root Admin
  • 11,041 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 06 February 2018 - 12:20 PM

Are you sure this worked elsewhere? The SQLConnection object is usually for Microsoft SQL Server, not MySQL...we don't offer Microsoft SQL Server.


Please do not PM me for support. Posting on our forums lets all of us learn.
Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...


#7 jackt

jackt

    Newbie

  • Members
  • 3 posts

Posted 07 February 2018 - 12:33 AM

Hi 

It worked elsewhere because the other host was using microsoft SQL. wolstech's message made me double check that I was using MySQL, which I was not. My code was for Microsoft SQL. 
I have since changed the code and all works as it should. 

Thank you for your help 

 

Jack. 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users