As per the WordPress core documentation, and since Local WP app uses MySQL sockets, consider modifying your wp-config.php
to include the use of MySQL Sockets.
MYSQL SOCKETS OR PIPES
If your host uses Unix sockets or pipes, adjust the DB_HOST value in the wp-config.php
file accordingly.
define( 'DB_HOST', '127.0.0.1:/var/run/mysqld/mysqld.sock' ); // or
define( 'DB_HOST', 'localhost:/var/run/mysqld/mysqld.sock' ); // or
define( 'DB_HOST', 'example.tld:/var/run/mysqld/mysqld.sock' );
Replace: /var/run/mysqld/mysqld.sock
with the socket or pipe information provided by your host.
You can find the MySQL socket for your current local site here:
Local WP App → Local Sites → Install Name → Database Tab → Socket.
Copy/paste that into your DB_HOST
constant definition in your wp-config.php
Example:
define( 'DB_HOST', 'localhost:/Users/%%USERNAME%%/Library/Application Support/Local/run/%%INSTALL_ID%%/mysql/mysqld.sock' );