I was running an older version of MAMP and found I couldn't install a current version of Wordpress because it required at least PHP version 5.2 so I updated MAMP which now runs 7.4.2. Things seemed to be fine with the update (sites are running) until I tried using interconnect's Search-Replace-DB on a project. Using the GUI, I got an AJAX error. The docs stated in the event of an AJAX error, I should follow the cli instructions; but when I do, I get either one of two errors no matter which approach I take:
db: SQLSTATE[HY000] [2002] Connection refused
db: SQLSTATE[HY000] [2002] No such file or directory
My wp-config.php looks like:
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'root');
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');
I read a SO post getting "db: SQLSTATE[HY000] [2002] Connection refused" error on Mac with MAMP and am trying the recommendation to replace the line '#!/usr/bin/php -q' with '#!/usr/bin/env php -q' in the rdb.cli.php file.
The cli commands I've tried: //posts suggest using 8889 but my mamp seems to run on :8888?
//using localhost string
php srdb.cli.php -h localhost -n test -u root -proot -s oldname.org -r localhost:8889 -v true -z
//using ip
php srdb.cli.php -h 127.0.0.1 -n test -u root -proot -s oldname.org -r localhost:8889 -v true -z
//using localhost string
php srdb.cli.php -h localhost -n test -u root -proot -s oldname.org -r localhost:8888 -v true -z
//using ip
php srdb.cli.php -h 127.0.0.1 -n test -u root -proot -s oldname.org -r localhost:8888 -v true -z
//Using path explicitly with ip
/Applications/MAMP/bin/php/php7.4.2/bin/php srdb.cli.php -h 127.0.0.1 -u root -n test -proot -s oldname.org -r localhost:/8888
After changing the line srdb.cli.php, I still can't connect. At this point, I don't know if it's php or mysql that is having an issue, if the db is corrupted, or if the environmental variables/paths/links are off after updating MAMP or how to go about determining these things. Any insights would be greatly appreciated.