0

I am struggling to reindex or run any editorial commands (apart changed to developer mode) via the CLI. From a feeling it could be an issue with permissions or connection between database and command files. I get all the time get "error reports:

 First line: "[Zend_Db_Adapter_Exception]                       
      SQLSTATE[HY000] [2002]No such file or directory"                                                  
    Second line:"[PDOException]                                    
      SQLSTATE[HY000] [2002] No such file or directory"

As example: can check cache status (get list), but not flush it (get error above). With indexer no commands works (all brings error lines listed above), but if I place only "bin/magento indewer" in CLI then I get a listed command list: [InvalidArgumentException]         
  Command "indexer" is not defined.  
  Did you mean one of these?         
      indexer:show-mode              
      indexer:set-mode               
      indexer:reindex                
      indexer:status                 
      indexer:reset                  
      indexer:info 

I am not a developer and relative new with Magento, could anyone help to find the issue cause and lead step by step to try solutions? I tried by now: - placing chmod u+x bin/magento to give permissions to run some queries, but maybe its not enough level? - installed magento via a "button" click on hosting company's website on php 5.6 with API CGI/FastCGI. - I tried to check settings in app\etc\env.php (for server status). All apart of key founded to prove and looks correct.

More about my previous ticket where we did not find a solution to reindex, but at least to call some commands out:

/bin/magento file cannot be opened (Magento 2.1)

3
  • Are you able to connect to the database? SQLSTATE[HY000] [2002] No such file or directory" looks like your database service isn't running on the server.
    – Pmclain
    Jun 24, 2017 at 22:57
  • yes via phpmyadmin GUI... no clue if my database runs on server, how could I check it? I think the database runs on the same server as the magento site content, but not sure. I use the hosting company that provides server and database. Let me know if I could proof smth and try some corrections to make it running.
    – Ausra
    Jun 25, 2017 at 12:08
  • Thank you - your hint was right. There was a specific IP demanded for SSH web server database access. After a placed adjustment in Plesk GUI it works the indexer command. Now have new challenge to overcome with set data capacity limit. Will post new question. Thank you for support!
    – Ausra
    Jun 26, 2017 at 13:10

1 Answer 1

0

First of all if you are trying to run indexer your command should be :

php bin\magento indexer:reindex

It will reindex all indexer

If you want to check available indexers your command should be :

php bin\magento indexer:info

If you want to reindex specific indexer your command should be:

php bin\magento indexer:reindex Indexer method name

Example: php bin\magento indexer:reindex catalog_category_product

If you want to check status of indexer your command should be :

php bin\magento indexer:status

If you want to check assigned mode of indexer your command should be :

php bin\magento indexer:show-mode

If you want to assign mode of indexer your command should be :

php bin\magent indexer:set-mode Mode Indexer method name

Example: php bin\magent indexer:set-mode realtime catalog_category_product

Note: there only 2 modes available realtime and schedule

For details you can check magento documentation here: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-index.html

Regarding Premission :

You can follow provided permission methods in magento documentation :

cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chown -R :<web server group> .
chmod u+x bin/magento

For detailed permission you can check magento docs.

http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

It should be error of My Sql host that you are using for your database.

You can ask your server support for MySql host ip address and replace localhost in app/etc/env.php with provided ip address and it should work.

16
  • Hi dear Aman, thank you for listed commands, unfortunately they all as mentioned bring the same error message. "php" in front is optional. Any ideas how to over come the error that I mentioned? As reminder from above, error message: [Zend_Db_Adapter_Exception] SQLSTATE[HY000] [2002] No such file or directory [PDOException] SQLSTATE[HY000] [2002] No such file or directory
    – Ausra
    Jun 24, 2017 at 22:51
  • can you please run df -h to check free space on your server
    – Aman Alam
    Jun 24, 2017 at 22:56
  • Also run this command to check inodes on server df -i
    – Aman Alam
    Jun 24, 2017 at 22:57
  • run command "df -h" , answer "bash: df: command not found"
    – Ausra
    Jun 24, 2017 at 22:58
  • ok try to check service mysqld status
    – Aman Alam
    Jun 24, 2017 at 23:00

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.