473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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.

Jan 12 '07 #1
4 1908
Rik
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:
http://www.php.net/manual/en/function.mysql-connect.php
"server

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

If the PHP directive mysql.default_host 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
Jan 12 '07 #2
C.

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.

Jan 12 '07 #3
Rik
C. wrote:
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 "
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
Jan 12 '07 #4
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.
Jan 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JL | last post by:
Platform: Linux Red Hat RHEL 3 (and red hat 9) Installed MySQL from source. As a matter of fact, installed all LAMPS from source, and the mysql socket file was arranged in a place other than...
0
by: Dennis Francis B. Tutanes | last post by:
$B$*@$OC$K$J$C$F$*$j$^$9!#(B $B%D%?%M%9(B@TSTI$B$G$9!#(B SEND-PR: -*- send-pr -*- SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as SEND-PR: will all comments (text...
0
by: I.P. | last post by:
Hi, it's my story. I have two 4.0.14 mysql server on one machine with win XP Professional polish version. First acts as master: on port 3300 Second acts as slave: on port 3301 below my...
0
by: I.P. | last post by:
No one has replied to my post. ----- Original Message ----- From: "I.P." <jancio_wodnik@wp.pl> To: <mysql@lists.mysql.com> Sent: Monday, August 18, 2003 1:01 PM Subject: mysql 4.0.14 +...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
3
by: Pugi! | last post by:
On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get the following problem when connecting to mysql through a browser (phpMyAdmin): : #2002 Can't connect to local MySQL...
1
by: jiing | last post by:
Now let me describe what I have done and my purpose: Originally, I want to user ports to install phpBB But I found that phpBB doesn't support mysql 5.x (but the ports installed mySQL 5.0.0...
8
by: sundeep.kumara | last post by:
hi all, I am a newbie .....I have compiled the source code of mysql-4.1.9 on PPC-Linux Its not giving any errors during configure,make or make install. But,when i try to start the server...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.