SQLSTATE[HY000] [2002] No such file or directory
Details
During or after installation, a message similar to the following displays:
Exception' with message 'PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000] [2002] No such file or directory
Solution
This is commonly caused by a different instance of PHP being used by the PHP command line compared to the web server. In particular, mysql.sock
might be misconfigured if this is the case.
To determine whether or not you鈥檙e using one instance of PHP:
- Log in to your Magento server.
-
Enter the following command:
php -i | grep 'php.ini'
This determines the settings used by the PHP command-line interface (CLI). Note where
php.ini
is located. - If you haven鈥檛 already done so, set up a phpinfo.php on your web server.
-
Compare the value of Loaded Configuration File from
phpinfo.php
with the one fromphp -i
.phpinfo.php
shows thephp.ini
file used by your web server. If it鈥檚 different from what鈥檚 in PHP鈥檚php.ini
, you must make all PHP settings consistent for both the PHP CLI and the web server.For additional details, consult the documentation provided with your web server.
Find us on