dbTalk Databases Forums  

mysqli socket error

comp.databases.mysql comp.databases.mysql


Discuss mysqli socket error in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Gordon Burditt
 
Posts: n/a

Default Re: mysqli socket error - 03-09-2010 , 01:50 AM






Quote:
You can always try to connect to the hostname of the machine (instead of
localhost/127.0.0.1), then it should connect to the port instead of using the
socket, which would be a work around for your configuration troubles.
A hostname of 'localhost' uses the local socket. That exact string
(case sensitive) is magic.
A hostname of '127.0.0.1' uses TCP/IP.
A hostname of 'Localhost' uses TCP/IP.
A hostname of 'localHost' uses TCP/IP.
A hostname of 'localhosT' uses TCP/IP.
A hostname of the local IP address of the machine uses TCP/IP.
A hostname that resolves in DNS to the local IP address of the
machine uses TCP/IP.

Using the local socket instead of TCP/IP is rumored to be faster.

If you want to test this, fire up the command-line utility with
the hostname you want to test (you have to straighten out the socket
location if you want to use '-h localhost'):

mysql -h 127.0.0.1

(with possibly additional username and password parameters) and
enter \s at the command-line prompt. It will spit out a screenful
of information. Look at the Connection: line, and note whether it
says "via local socket" vs. "via TCP/IP".

Quote:
I don't think I changed anything and I thought it was working but I
just started writing a script using mysqli.

Using packages released by the OS maintainer are always better than using 3rd
party packages or compile those yourself, as those official packages will
always work.
If you're going to use a local socket, it's the responsibility of
the admin / programmer / user (whichever is specifying the socket
location) to ensure that the server, the command-line client
utilities, and PHP all agree on the location of the socket. An
exception occurs if you are running two instances of the server on
the same host, in which case it is even more important to ensure
that the client command-line utilities and PHP use the same socket
location as the *correct* server instance.

Reply With Quote
  #12  
Old   
Peter H. Coffin
 
Posts: n/a

Default Re: mysqli socket error - 03-09-2010 , 08:57 AM






On Tue, 09 Mar 2010 00:50:48 -0600, Gordon Burditt wrote:
Quote:
You can always try to connect to the hostname of the machine (instead of
localhost/127.0.0.1), then it should connect to the port instead of using the
socket, which would be a work around for your configuration troubles.

A hostname of 'localhost' uses the local socket. That exact string
(case sensitive) is magic.
A hostname of '127.0.0.1' uses TCP/IP.
A hostname of 'Localhost' uses TCP/IP.
A hostname of 'localHost' uses TCP/IP.
A hostname of 'localhosT' uses TCP/IP.
A hostname of the local IP address of the machine uses TCP/IP.
A hostname that resolves in DNS to the local IP address of the
machine uses TCP/IP.

Using the local socket instead of TCP/IP is rumored to be faster.
Possibly more importantly, the local socket cannot usually be connected
to from anywhere OTHER than the local machine, even via a tunnel
mechanism. So it's kind of hard to accidently leak data via a guessable
or retained password.

--
81. If I am fighting with the hero atop a moving platform, have
disarmed him, and am about to finish him off and he glances behind
me and drops flat, I too will drop flat instead of quizzically
turning around to find out what he saw. --Evil Overlord list

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.