Note, this post is also posted over at dev.to
This is going to be short (I've been meaning to write it for a while), but first go read this post by my good friend Sal Ferrarello as a precursor to this one, then come back and read this.
Now that you've read Sal's post, you can actually do this easier now using Local:
You don't need to create a
wp-cli.local.php file, all you need to do is edit your current
wp-config.php and find this section:
Now change the part where you have
define( 'DB_HOST', 'localhost' ); and change it to:
defined( 'WP_CLI' ) && WP_CLI ? define( 'DB_HOST', 'localhost:/Users/aubreypwd/Library/Application Support/Local/run/do55POv0_/mysql/mysqld.sock' ) : define( 'DB_HOST', 'localhost' );
/Users/aubreypwd/Library/Application Support/Local/run/do55POv0_/mysql/mysqld.sock with your sock file from Local:
...and that's all you need to do now!