We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Error: SQLSTATE[HY000] [2002] No such file or directory

Hello,

So I've installed the Phalcon plugin for my MAMP installation and the DevTools. Now I'm trying to create my first project. I've generated the skeleton, the controller but when I'm now at the model I'm met with a error. This error looks like this:

Can someone help me solve this? I've tried googling but can't find a solution...



98.9k

You need to change the location of the mysql socket in php.ini:

pdo_mysql.default_socket=/opt/local/var/run/mysql55/mysqld.sock

You can see the real path to the socket this way:

$ mysql -u root -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.36 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%socket%';
+---------------+----------------------------------------+
| Variable_name | Value                                  |
+---------------+----------------------------------------+
| socket        | /opt/local/var/run/mysql55/mysqld.sock |
+---------------+----------------------------------------+
1 row in set (0.04 sec)

But since I use MAMP, shouldn't I use the socket file of MAMP?

edited Jan '15

Ok, I managed to do the above and this is my results:

But still, it doesn't work...



5.4k
Accepted
answer
edited Jan '15

So THIS solved my question.

But when I type in "phalcon model products" I get this error message:

EDIT: I didn't know I had to create the table myself. Sorry about that :)