PHP memory limit error when importing / Failed to get current SQL modes. Reason: ERROR 2003 (HY000)

I’m glad of the assistance in solving my current problem but surely this is a bug.

When using wp db import your-database-filename.sql from the Local Site Shell the Local Database port is not correctly identified.

Importing an existing website database is documented at Import/Export a WordPress Site - Manually Import a Local site. But this clearly often does not work on Windows computers.

Local Shell uses port 10061

Local Database port is different

Fixed by following Workaround

This can be fixed by following this Workaround where the actual Local Database port is added in the Local site’s wp-config.php file.

If the Local Site Shell was able to correctly identify the Local Database port on Windows computers, this particular problem would be eliminated for Windows users.