Magento 2 install sample data error

If you ever faced magento 2 installing sample data error using MAMP on local,

1
2
3
4
5
6
7
Zend_Db_Adapter_Exception]

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

[PDOException]

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

here’s a solution for you, provided you are using composer to install magento, this happened to me while updating the sample data, php magentoFolder/bin/magento setup:upgrade

1
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock