A link to the server could not be established in...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Reply-Via-Newsgroup

    A link to the server could not be established in...


    Folks,

    I'm writing an application on a LAMPhp server... Everything has been fine up
    until now though I have only got about 6months of MySQL behind me.

    Today... my server has started to report the following while trying to do a
    mysql_query() select from an empty table...

    Warning: mysql_query(): Can't connect to local MySQL server through socket
    '/tmp/mysql.sock' (2) in
    /data/www/websites/mydomain.com/www/include2/standard/MySQL.fip on line 139

    Warning: mysql_query(): A link to the server could not be established in
    /data/www/websites/mydomain.com/www/include2/standard/MySQL.fip on line 139


    Two things though:
    1) I have output the query to the browser, then cut and pasted it in to the
    mysql command line and it executes, returning no errors, and zero rows.
    2) I can connect both from the server, and my client machines to MySQL...

    So where could my problem be? I'm the only user on the box...

    anybody got any ideas? My code at line 139 works fine as the same group of
    functions work in my other coded projects so I know it can't be that...

    Thanks in advance,
    randell d.


  • Aggro

    #2
    Re: A link to the server could not be established in...

    Reply-Via-Newsgroup wrote:
    [color=blue]
    > Warning: mysql_query(): Can't connect to local MySQL server through socket
    > '/tmp/mysql.sock' (2) in[/color]

    Well, is there a file /tmp/mysql.sock in the server? Looks like php is
    assigned to use socket file in there, but I bulieve MySQL uses socket
    file in another place. Don't remember how it was checked, but try to
    find out what socket file MySQL uses and compare it to the one php uses.
    If they don't match, either php or MySQL needs to be reconfigured.

    Comment

    • Aggro

      #3
      Re: A link to the server could not be established in...

      Reply-Via-Newsgroup wrote:
      [color=blue]
      > Warning: mysql_query(): Can't connect to local MySQL server through socket
      > '/tmp/mysql.sock' (2) in[/color]

      Well, is there a file /tmp/mysql.sock in the server? Looks like php is
      assigned to use socket file in there, but I bulieve MySQL uses socket
      file in another place. Don't remember how it was checked, but try to
      find out what socket file MySQL uses and compare it to the one php uses.
      If they don't match, either php or MySQL needs to be reconfigured.

      Comment

      • Aggro

        #4
        Re: A link to the server could not be established in...

        Reply-Via-Newsgroup wrote:
        [color=blue]
        > Warning: mysql_query(): Can't connect to local MySQL server through socket
        > '/tmp/mysql.sock' (2) in[/color]

        Well, is there a file /tmp/mysql.sock in the server? Looks like php is
        assigned to use socket file in there, but I bulieve MySQL uses socket
        file in another place. Don't remember how it was checked, but try to
        find out what socket file MySQL uses and compare it to the one php uses.
        If they don't match, either php or MySQL needs to be reconfigured.

        Comment

        • Reply-Via-Newsgroup

          #5
          Re: A link to the server could not be established in...


          "Aggro" <spammerdream@y ahoo.com> wrote in message
          news:%AoRb.35$K X3.16@read3.ine t.fi...[color=blue]
          > Reply-Via-Newsgroup wrote:
          >[color=green]
          > > Warning: mysql_query(): Can't connect to local MySQL server through[/color][/color]
          socket[color=blue][color=green]
          > > '/tmp/mysql.sock' (2) in[/color]
          >
          > Well, is there a file /tmp/mysql.sock in the server? Looks like php is
          > assigned to use socket file in there, but I bulieve MySQL uses socket
          > file in another place. Don't remember how it was checked, but try to
          > find out what socket file MySQL uses and compare it to the one php uses.
          > If they don't match, either php or MySQL needs to be reconfigured.[/color]

          The file doesn't exist - I don't know if that is a good thing or not -
          However I put a mysql connect before my insert and things worked fine...

          I think it was because I had no persistent connections open to the db - And
          I've not had this before - But... thinking further... I did reboot the box
          earlier and its possible this had everything to do with no pre-existing
          connections... I'll have to remember that in future...

          Thanks though for the post...

          randelld


          Comment

          • Reply-Via-Newsgroup

            #6
            Re: A link to the server could not be established in...


            "Aggro" <spammerdream@y ahoo.com> wrote in message
            news:%AoRb.35$K X3.16@read3.ine t.fi...[color=blue]
            > Reply-Via-Newsgroup wrote:
            >[color=green]
            > > Warning: mysql_query(): Can't connect to local MySQL server through[/color][/color]
            socket[color=blue][color=green]
            > > '/tmp/mysql.sock' (2) in[/color]
            >
            > Well, is there a file /tmp/mysql.sock in the server? Looks like php is
            > assigned to use socket file in there, but I bulieve MySQL uses socket
            > file in another place. Don't remember how it was checked, but try to
            > find out what socket file MySQL uses and compare it to the one php uses.
            > If they don't match, either php or MySQL needs to be reconfigured.[/color]

            The file doesn't exist - I don't know if that is a good thing or not -
            However I put a mysql connect before my insert and things worked fine...

            I think it was because I had no persistent connections open to the db - And
            I've not had this before - But... thinking further... I did reboot the box
            earlier and its possible this had everything to do with no pre-existing
            connections... I'll have to remember that in future...

            Thanks though for the post...

            randelld


            Comment

            • Aggro

              #7
              Re: A link to the server could not be established in...

              Reply-Via-Newsgroup wrote:
              [color=blue]
              > Warning: mysql_query(): Can't connect to local MySQL server through socket
              > '/tmp/mysql.sock' (2) in
              > /data/www/websites/mydomain.com/www/include2/standard/MySQL.fip on line 139[/color]

              Come to think of it.. some people have had problems, because operating
              system clears tmp/ folder automaticly. You might be safer to sertup the
              file to be somewhere else.

              Comment

              • Reply-Via-Newsgroup

                #8
                Re: A link to the server could not be established in...


                "Aggro" <spammerdream@y ahoo.com> wrote in message
                news:%AoRb.35$K X3.16@read3.ine t.fi...[color=blue]
                > Reply-Via-Newsgroup wrote:
                >[color=green]
                > > Warning: mysql_query(): Can't connect to local MySQL server through[/color][/color]
                socket[color=blue][color=green]
                > > '/tmp/mysql.sock' (2) in[/color]
                >
                > Well, is there a file /tmp/mysql.sock in the server? Looks like php is
                > assigned to use socket file in there, but I bulieve MySQL uses socket
                > file in another place. Don't remember how it was checked, but try to
                > find out what socket file MySQL uses and compare it to the one php uses.
                > If they don't match, either php or MySQL needs to be reconfigured.[/color]

                The file doesn't exist - I don't know if that is a good thing or not -
                However I put a mysql connect before my insert and things worked fine...

                I think it was because I had no persistent connections open to the db - And
                I've not had this before - But... thinking further... I did reboot the box
                earlier and its possible this had everything to do with no pre-existing
                connections... I'll have to remember that in future...

                Thanks though for the post...

                randelld


                Comment

                • Aggro

                  #9
                  Re: A link to the server could not be established in...

                  Reply-Via-Newsgroup wrote:
                  [color=blue]
                  > Warning: mysql_query(): Can't connect to local MySQL server through socket
                  > '/tmp/mysql.sock' (2) in
                  > /data/www/websites/mydomain.com/www/include2/standard/MySQL.fip on line 139[/color]

                  Come to think of it.. some people have had problems, because operating
                  system clears tmp/ folder automaticly. You might be safer to sertup the
                  file to be somewhere else.

                  Comment

                  • Aggro

                    #10
                    Re: A link to the server could not be established in...

                    Reply-Via-Newsgroup wrote:
                    [color=blue]
                    > Warning: mysql_query(): Can't connect to local MySQL server through socket
                    > '/tmp/mysql.sock' (2) in
                    > /data/www/websites/mydomain.com/www/include2/standard/MySQL.fip on line 139[/color]

                    Come to think of it.. some people have had problems, because operating
                    system clears tmp/ folder automaticly. You might be safer to sertup the
                    file to be somewhere else.

                    Comment

                    Working...