mysql5 problem?

Ryan Schmidt ryandesign at macports.org
Fri Apr 13 05:12:01 PDT 2007


On Apr 12, 2007, at 17:20, Karl Timmermann wrote:

>> Need more info. What concrete problem do you experience? What  
>> error message? Is it about the socket file not existing? If so,  
>> does it tell you what path it's looking for the socket file at? If  
>> so, does the socket exist there? If so, are its permissions OK? If  
>> the socket is not there, why not? Is your mysql server running?  
>> What OS version? What processor architecture? What solutions have  
>> you already tried? etc. etc. etc.
>
> I can't connect to the mysql server using any tool or program using  
> root at localhost (connecting to "localhost" using the username of  
> "root" and my password). I can however connect if I connect to  
> 127.0.0.1 using root. I have the root user work at any domain.  
> Errors are different depending on which program I use, but  
> basically it says I can't connect. If I try to connect using the  
> socket, it works (not the default socket, but the one that the port  
> specifies). I'm running OS X 10.4.9 on an Intel Core 2 Duo.
>
> Basically, localhost is not pointing to the correct socket file. If  
> that could be fixed, it would be fine with me, since all my code  
> and apps point to localhost right now. I don't want to have to add  
> a Unix socket path in every bit of code where I have the connection  
> details. Ideally, it should use TCP/IP when connecting to  
> localhost. If I wanted to use a socket, I would have specified one.
>
> I guess the 2 solutions needed (or just one) would be: 1.) How do I  
> make MySQL's localhost mechanism point to the correct socket file  
> if a custom one was specified when compiling mysql via MacPorts,

The mysql5 portfile uses the configure option

--with-unix-socket-path=${prefix}/var/run/${name}/mysqld.sock

${prefix} is usually /opt/local and ${name} is mysql5 so the socket  
file should be at

/opt/local/var/run/mysql5/mysqld.sock

That means that the mysql5 server will put its socket there, and the  
mysql5 client will look for the socket there.

Are you running both the MacPorts mysql5 server and the MacPorts  
mysql5 client? If so, it should just work:

$ /opt/local/lib/mysql5/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 88
Server version: 5.0.37-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


What do you get when you type the above command?


> and 2.) how do I turn off this "feature" and let localhost resolve  
> to 127.0.0.1?

That's just the way MySQL works. If you say "localhost", it uses the  
socket file instead of the network stack. You'll have to speak with  
the MySQL developers regarding whether it's possible to disable that  
behavior, although I'm sure the behavior exists for a reason,  
probably a performance one.





More information about the macports-users mailing list