How to use multiplce MySQL socket on a single web server?

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

    How to use multiplce MySQL socket on a single web server?

    in the php.ini, i can't only config to use one mysql socket, but my
    applications require connection to ultiple local mysql server, using
    unix socket, listening different port

    any hints?

    thanks.

  • Rik

    #2
    Re: How to use multiplce MySQL socket on a single web server?

    howa wrote:
    in the php.ini, i can't only config to use one mysql socket, but my
    applications require connection to ultiple local mysql server, using
    unix socket, listening different port
    >
    any hints?
    >
    thanks.
    $link1 = mysql_connect ( 'localhost:3306 ','user','pass' );
    $link2 = mysql_connect ( 'localhost:6000 ','user','pass' );

    Etc.
    From the manual:

    "server

    The MySQL server. It can also include a port number. e.g. "hostname:p ort"
    or a path to a local socket e.g. ":/path/to/socket" for the localhost.

    If the PHP directive mysql.default_h ost is undefined (default), then the
    default value is 'localhost:3306 '. In SQL safe mode, this parameter is
    ignored and value 'localhost:3306 ' is always used."

    So, the server specified in the ini is just the default, which php will
    connect to if no values are given (so, with the proper values set,
    mysql_connect() ; could work).
    --
    Rik Wasmus


    Comment

    • C.

      #3
      Re: How to use multiplce MySQL socket on a single web server?


      Rik wrote:
      howa wrote:
      in the php.ini, i can't only config to use one mysql socket, but my
      applications require connection to ultiple local mysql server, using
      unix socket, listening different port
      >
      $link1 = mysql_connect ( 'localhost:3306 ','user','pass' );
      $link2 = mysql_connect ( 'localhost:6000 ','user','pass' );
      >
      These are NETWORK sockets not UNIX sockets.

      howa: RTFM dude - "3.0.10 Added support for ":/path/to/socket" with
      server "

      C.

      Comment

      • Rik

        #4
        Re: How to use multiplce MySQL socket on a single web server?

        C. wrote:
        Rik wrote:
        >howa wrote:
        >>in the php.ini, i can't only config to use one mysql socket, but my
        >>application s require connection to ultiple local mysql server, using
        >>unix socket, listening different port
        >>
        >$link1 = mysql_connect ( 'localhost:3306 ','user','pass' );
        >$link2 = mysql_connect ( 'localhost:6000 ','user','pass' );
        >>
        >
        These are NETWORK sockets not UNIX sockets.
        >
        howa: RTFM dude - "3.0.10 Added support for ":/path/to/socket" with
        server "
        Well, it was just an illustration that your default mysql settings in the
        ini file have nothing to do with the actual connections you create. The
        link I posted also explains how that works with UNIX sockets.
        --
        Rik Wasmus


        Comment

        • Colin McKinnon

          #5
          Re: How to use multiplce MySQL socket on a single web server?

          Rik wrote:
          C. wrote:
          >These are NETWORK sockets not UNIX sockets.
          >>
          >howa: RTFM dude - "3.0.10 Added support for ":/path/to/socket" with
          >server "
          >
          Well, it was just an illustration that your default mysql settings in the
          ini file have nothing to do with the actual connections you create. The
          link I posted also explains how that works with UNIX sockets.
          Sorry to cast aspersions, Rik - I didn't know that part of your post was
          missing in my newsreader (crappy Google scraper).

          Your post did answer the question.

          C.

          Comment

          Working...