Mac Os

SQLSTATE[HY000] [2002] No such file or directory (after magento setup:upgrade on Mac OS)

The problem occures, when you trying to upgrade Magento with the terminal (for example on your localhost which is a Mac)

You typed in:

and the result ist:


The problem is, that php in the Mac-Terminal is running with another php-ini-file than the Apache-Server.

To test that, do the followin:

1.) Find out the path of the php.ini-file that is used by the Mac.
For thattype into the terminal:

2.) Find out the php.ini-file of your localhost Apache-Server
Create a phpinfo-file (phpinfo.php) with the content: <?php phpinfo() ?> . I’m currently using Mamp Pro so for that example the path is:

If the path is NOT the same as the one your Mac is using in the terminal, you now know where the problem is. (Magento is also explaining this issue in this post.)

3.) Create Symlink (symbolic link) from one php.ini-file to the other.
One solution to correct that is, to create a simlink from your Mac-php-ini file to the MAMP Pro – directory, which can be done by the simple command: