MySQL #2002 - No such file or directory

Ryan Schmidt ryandesign at macports.org
Wed Sep 7 09:12:46 PDT 2016


> On Sep 7, 2016, at 10:49 AM, Ignatios Athanasiadis <ignathanas at gmail.com> wrote:
> 
> Hello,
> 
> Thank you for the information.
> Are you referring to a mysql.sock or a mysqld.sock file?

I'm referring to the MySQL socket file. Different people and distributions configure it in different ways, and with different names. It doesn't matter what the file is called, only that it was created by MySQL and is a socket to communicate with it.

> The problem was that there was no mysql.sock file anyware in my computer.
> The only socket file I could find was a mysqld.sock one.

Ok, then use mysqld.sock.

> To generate the mysql.sock, I included the code below in the my.cnf file.
> 
> [client]
> port=3306
> socket=/tmp/mysql.sock
> 
> [mysqld]
> port=3306
> socket=/tmp/mysql.sock
> key_buffer_size=16M
> max_allowed_packet=8M
> 
> [mysqldump]
> quick
> 
> Now it works, no error is generated.

You should not configure MySQL to put its socket file in /tmp; that's less secure. You should use the socket file in the location where MacPorts puts it, which, for mysql57, is /opt/local/var/run/mysql57/mysqld.sock. The default MacPorts PHP configuration should already be configured to use the MySQL socket from that location.



More information about the macports-users mailing list