Opened 11 years ago

Closed 11 years ago

#22217 closed defect (fixed)

No mysql.sock, mysqld.sock, mysqli.sock, or any *.sock

Reported by: me@… Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.8.0
Keywords: Cc:
Port: mysql5

Description

OK, I installed apache2, php5, mysql5, and php5-mysql and when every I try to do any MYSQL-Related things in PHP, I get this error:

Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in [...] on line 2

... and I checked and there is not even a file /opt/local/var/run/mysql5 for a mysqld.sock file to be. when I do a search for any *.sock file, this is what I get:

iMac:~ hank$ locate *.sock
/private/var/run/vpncontrol.sock
iMac:~ hank$ locate .sock
/private/var/run/com.apple.ActivityMonitor.socket
/private/var/run/com.noiseindustries.FxFactory.socket
/private/var/run/portmap.socket
/private/var/run/vpncontrol.sock

Change History (4)

comment:1 Changed 11 years ago by jmroot (Joshua Root)

Owner: changed from macports-tickets@… to ryandesign@…
Port: mysql5 added

comment:2 Changed 11 years ago by ryandesign (Ryan Schmidt)

"locate" only updates things once a week or so. Try "find" instead.

The directory /opt/local/var/run/mysql5 should exist if you installed the mysql5-server port. Did you? Is your MySQL server running?

php5 needs to be told where the socket is. The php5-mysql port printed this instruction for you when you installed it:

To use mysqlnd with a local MySQL server, edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock

Did you do that?

FYI, see also #21250 which is the request to make modifications to your php.ini unnecessary.

comment:3 Changed 11 years ago by me@…

I fixed it. I realized I did not have the mysql5-server port installed, so when I did, I fixed it. Thanks for your help though. If you didn't mention mysql5-server, I would have never figured it out

comment:4 Changed 11 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: newclosed

Glad you got it working.

In r59852 I added a post-install message notifying the user of the existence of the server port. Hopefully this will help others in the future.

Note: See TracTickets for help on using tickets.