Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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...



84.5k

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...



2.6k
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 :)