Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem connecting to MySQL

Problem connecting to MySQL

Scheduled Pinned Locked Moved C#
helpcsharpdatabasemysqlsysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I am trying to connect to mySql using C# but getting this error:

    Quote:

    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

    I have added the port thinking it could solve the issue! but still the same.. here is my connection string:

    <add name="SQLdb" connectionString="server=192.168.0.1;port=3306;User Id=root;password=Mxjxaxax0x1;Persist Security Info=True;database=cure"
    providerName="MySql.Data.MySqlClient" />

    please help...

    L 1 Reply Last reply
    0
    • J Jassim Rahma

      Hi, I am trying to connect to mySql using C# but getting this error:

      Quote:

      A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

      I have added the port thinking it could solve the issue! but still the same.. here is my connection string:

      <add name="SQLdb" connectionString="server=192.168.0.1;port=3306;User Id=root;password=Mxjxaxax0x1;Persist Security Info=True;database=cure"
      providerName="MySql.Data.MySqlClient" />

      please help...

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The answer is bound to be here :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      J 1 Reply Last reply
      0
      • L Luc Pattyn

        The answer is bound to be here :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        J Offline
        J Offline
        Jassim Rahma
        wrote on last edited by
        #3

        Thanks BUT now this is my connection in the App.config:

        <add name="SQLdb"connectionString="server=192.168.0.1;port=3306;Uid=root;Pwd=xxxxxxxxx;database=cure;" providerName="MySql.Data.MySqlClient" />

        but I am still getting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond just one notes: The same code is working if I run the application on the server itself (using IP not localhost)

        M 1 Reply Last reply
        0
        • J Jassim Rahma

          Thanks BUT now this is my connection in the App.config:

          <add name="SQLdb"connectionString="server=192.168.0.1;port=3306;Uid=root;Pwd=xxxxxxxxx;database=cure;" providerName="MySql.Data.MySqlClient" />

          but I am still getting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond just one notes: The same code is working if I run the application on the server itself (using IP not localhost)

          M Offline
          M Offline
          Matt Meyer
          wrote on last edited by
          #4

          What happens if you try to connect to the database using a standard MySQL client? It almost looks like a firewall may be blocking your connection.

          J 1 Reply Last reply
          0
          • M Matt Meyer

            What happens if you try to connect to the database using a standard MySQL client? It almost looks like a firewall may be blocking your connection.

            J Offline
            J Offline
            Jassim Rahma
            wrote on last edited by
            #5

            it works when I connect using mySQL client but the good news.. I figured out the problem... I just address connection timeout=120 it seems like it's taking time to connect! anyhow.. thanks...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups