Local site shell not working properly

What issue or error are you experiencing?

After I run a wp-cli command such as wp db export database.sql, it says ‘grep’ is not recognized as internal or external command. Warning: Failed to get current character set of the posts table. Reason: ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

mysqldump: Got error: 2002: “Can’t connect to MySQL server on ‘localhost’ (10061)” when trying to connect


What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

open site shell and run wp-cli command


System Details

  • Local Version:
    Version 9.0.1+6673
  • Operating System (OS) and OS version:
    Windows 10 64-bit

Local Logs

not allowed to paste (too many chars) and can’t see button to attach.


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi, @ProgramadorWP. Please could you try the solution recommended here? It’s specific to the wp db import command but may work for wp db export too.

Thanks, but it did not help. Before the database error, it spits a grep error

C:\Users\Rafa Carvalhido\Local Sites\forja-dos-mestres\app\public>wp db export teste.sql
'grep' is not recognized as internal or external command , an operable program or a batch file.
Warning: Failed to get current character set of the posts table. Reason: ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061)

mysqldump: Got error: 2002: "Can't connect to MySQL server on 'localhost' (10061)" when trying to connect

I tried installing cygwin, but didn’t help.

Thanks for trying that, @ProgramadorWP.

For the wp-config.php update, are you using the port number from your site’s database tab (and not the 10061 reported in your message)? When I use the correct port number I’m able to export fine on Windows (the grep message alone should not prevent the export).

Also important to check that the site is running, otherwise you’ll see the same connection error.

True, it was another port, but I solved it by installing Git Bash and changing the prefered program for site shell…

The problem was the ‘grep’ part of the message, I guess.

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.