1

MacOS High Sierra MAMP php webserver - 7.2.10

/Applications/MAMP/bin/php/php7.2.10/bin//php- 7.2.10

 -- usr/bin/php - 7.1.16




Nittns-MacBook-Air:~ baanallc$ cd /applications/MAMP/htdocs/23/

Nittns-MacBook-Air:23 baanallc$ php bin/magento indexer:reindex

In Abstract.php line 144:

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


In Abstract.php line 128:

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


indexer:reindex [<index>...]

Please advise, how can I reindex magento2 on localhost MAMP?

2
  • looks like mysql is not started yet. Try to restart xampp or mamp Dec 6, 2018 at 5:02
  • change from DB_HOST=localhost to DB_HOST=127.0.0.1 at .env file and try it by clearing cache
    – Ruhani
    Dec 6, 2018 at 10:24

3 Answers 3

0

Ok, I found out the way. I had 3 PHP installed

  1. /usr/bin/php ----------------------------- macOS default php 7.1
  2. /usr/local/cellar/php/7.2.12_2/bin/php ---- Home-brew php 7.2
  3. /Applications/MAMP/bin/php/php7.2.10/bin/php --MAMP php

-------did following changes and indexes and cron jobs worked like magic.-----

  1. Changed the directory to Magento home dir ------(use your Magento install dir)

    $ cd /applications/MAMP/htdocs/23/

  2. Changed PHP PATH to same as being used by Magento --(use Path of PHP used for Magento web server)

    $ export PATH=/Applications/MAMP/bin/php/php7.2.10/bin/:$PATH

0

try to change the hostname:

 From 'localhost' to '127.0.0.1' in app/etc/env.php
0

Iam also facing the same error while run the Flush the Cache and Reindex commands. I have found the issue was my MySQL server got stop.

Everything is working fine after Restart the MySql in my Server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.