can't connect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shelly

    #1

    can't connect

    (also posted to alt.php.sql and comp.databases. mysql)

    This is an old problem. I extensively researched the postings on the
    internet and have found no solution. So, perhaps someone here can help.

    The problem is that from my index.php file I get:

    Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock'

    Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
    is running. It shows it there (size 0, as it should be). Furthermore, I
    can connect from command line and can do mysql commands. The mysql is on
    the same machine as the web server, so I use localhost as the host. php is
    running on the server as well. The ini file shows the default location of
    be empty, so it should default to the installation default of
    /var/lib/mysql/, and it does since it shows up with an ls.

    One post suggested changing ownership and group to mysql. I did that, but
    in reality that is how was originally anyhow.

    So, I am stumped. Are there any suggestions?

    Shelly



  • Steve

    #2
    Re: can't connect

    On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
    [color=blue]
    > (also posted to alt.php.sql and comp.databases. mysql)
    >
    > This is an old problem. I extensively researched the postings on the
    > internet and have found no solution. So, perhaps someone here can help.
    >
    > The problem is that from my index.php file I get:
    >
    > Can't connect to local MySQL server through socket
    > '/var/lib/mysql/mysql.sock'
    >
    > Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
    > is running. It shows it there (size 0, as it should be). Furthermore, I
    > can connect from command line and can do mysql commands. The mysql is on
    > the same machine as the web server, so I use localhost as the host. php is
    > running on the server as well. The ini file shows the default location of
    > be empty, so it should default to the installation default of
    > /var/lib/mysql/, and it does since it shows up with an ls.
    >
    > One post suggested changing ownership and group to mysql. I did that, but
    > in reality that is how was originally anyhow.
    >
    > So, I am stumped. Are there any suggestions?
    >
    > Shelly[/color]

    What relevant entries do you have in php.ini? Dos it redefine the socket
    to use?

    There are off my test server, which works fine...

    Client API version 4.1.14
    MYSQL_MODULE_TY PE external
    MYSQL_SOCKET /var/run/mysqld/mysqld.sock
    MYSQL_INCLUDE -I/usr/include/mysql
    MYSQL_LIBS -L/usr/lib -lmysqlclient


    Comment

    • Shelly

      #3
      Re: can't connect


      "Steve" <ThisOne@Aint.V alid> wrote in message
      news:pan.2006.0 1.18.08.22.51.6 91382@Aint.Vali d...[color=blue]
      > On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
      >[color=green]
      >> (also posted to alt.php.sql and comp.databases. mysql)
      >>
      >> This is an old problem. I extensively researched the postings on the
      >> internet and have found no solution. So, perhaps someone here can help.
      >>
      >> The problem is that from my index.php file I get:
      >>
      >> Can't connect to local MySQL server through socket
      >> '/var/lib/mysql/mysql.sock'
      >>
      >> Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the
      >> daemon
      >> is running. It shows it there (size 0, as it should be). Furthermore, I
      >> can connect from command line and can do mysql commands. The mysql is on
      >> the same machine as the web server, so I use localhost as the host. php
      >> is
      >> running on the server as well. The ini file shows the default location
      >> of
      >> be empty, so it should default to the installation default of
      >> /var/lib/mysql/, and it does since it shows up with an ls.
      >>
      >> One post suggested changing ownership and group to mysql. I did that,
      >> but
      >> in reality that is how was originally anyhow.
      >>
      >> So, I am stumped. Are there any suggestions?
      >>
      >> Shelly[/color]
      >
      > What relevant entries do you have in php.ini? Dos it redefine the socket
      > to use?
      >
      > There are off my test server, which works fine...
      >
      > Client API version 4.1.14
      > MYSQL_MODULE_TY PE external
      > MYSQL_SOCKET /var/run/mysqld/mysqld.sock
      > MYSQL_INCLUDE -I/usr/include/mysql
      > MYSQL_LIBS -L/usr/lib -lmysqlclient[/color]

      There are no MYSQL entries in php.ini. There are several mysql entries, but
      none of those. The mysql_default_s ocket is empty, which should take it to
      /var/lib/mysql -- which is where I found it.

      Shelly


      Comment

      • Shelly

        #4
        Re: can't connect


        "Shelly" <sheldonlg.news @asap-consult.com> wrote in message
        news:spudncf2lp oHslPeRVn-hA@comcast.com. ..[color=blue]
        >
        > "Steve" <ThisOne@Aint.V alid> wrote in message
        > news:pan.2006.0 1.18.08.22.51.6 91382@Aint.Vali d...[color=green]
        >> On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
        >>[color=darkred]
        >>> (also posted to alt.php.sql and comp.databases. mysql)
        >>>
        >>> This is an old problem. I extensively researched the postings on the
        >>> internet and have found no solution. So, perhaps someone here can help.
        >>>
        >>> The problem is that from my index.php file I get:
        >>>
        >>> Can't connect to local MySQL server through socket
        >>> '/var/lib/mysql/mysql.sock'
        >>>
        >>> Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the
        >>> daemon
        >>> is running. It shows it there (size 0, as it should be). Furthermore,
        >>> I
        >>> can connect from command line and can do mysql commands. The mysql is
        >>> on
        >>> the same machine as the web server, so I use localhost as the host. php
        >>> is
        >>> running on the server as well. The ini file shows the default location
        >>> of
        >>> be empty, so it should default to the installation default of
        >>> /var/lib/mysql/, and it does since it shows up with an ls.
        >>>
        >>> One post suggested changing ownership and group to mysql. I did that,
        >>> but
        >>> in reality that is how was originally anyhow.
        >>>
        >>> So, I am stumped. Are there any suggestions?
        >>>
        >>> Shelly[/color]
        >>
        >> What relevant entries do you have in php.ini? Dos it redefine the socket
        >> to use?
        >>
        >> There are off my test server, which works fine...
        >>
        >> Client API version 4.1.14
        >> MYSQL_MODULE_TY PE external
        >> MYSQL_SOCKET /var/run/mysqld/mysqld.sock
        >> MYSQL_INCLUDE -I/usr/include/mysql
        >> MYSQL_LIBS -L/usr/lib -lmysqlclient[/color][/color]

        From phpinfo() I get:

        mysql
        MySQL Support enabled
        Active Persistent Links 0
        Active Links 0
        Client API version 3.23.58
        MYSQL_MODULE_TY PE external
        MYSQL_SOCKET /var/lib/mysql/mysql.sock
        MYSQL_INCLUDE -I/usr/include/mysql
        MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient


        Comment

        • David Haynes

          #5
          Re: can't connect

          Shelly wrote:[color=blue]
          > (also posted to alt.php.sql and comp.databases. mysql)
          >
          > This is an old problem. I extensively researched the postings on the
          > internet and have found no solution. So, perhaps someone here can help.
          >
          > The problem is that from my index.php file I get:
          >
          > Can't connect to local MySQL server through socket
          > '/var/lib/mysql/mysql.sock'
          >
          > Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
          > is running. It shows it there (size 0, as it should be). Furthermore, I
          > can connect from command line and can do mysql commands. The mysql is on
          > the same machine as the web server, so I use localhost as the host. php is
          > running on the server as well. The ini file shows the default location of
          > be empty, so it should default to the installation default of
          > /var/lib/mysql/, and it does since it shows up with an ls.
          >
          > One post suggested changing ownership and group to mysql. I did that, but
          > in reality that is how was originally anyhow.
          >
          > So, I am stumped. Are there any suggestions?
          >
          > Shelly
          >
          >
          >[/color]
          I don't know if you've already checked this, but you mention changing
          ownership and group but not permissions.

          Your web server will be running as a certain user. For example, apache
          runs as user 'nobody' unless you change it. Are your permissions open
          enough to allow user nobody to use the socket file?

          It should probably have full read/write/execute permissions for user,
          group and world.

          -david-

          Comment

          • sheldonlg@gmail.com

            #6
            Re: can't connect

            Solution: The problem was in SELinux. It was too restrictive.

            Comment

            Working...