Local Community

WP-Cli issue with WSL2 MySQL extension issue

I am using Local by wheel on my windows 11 and its working great. However, I am using WSL2 as well because I am developing on Sage 10 theme. I need to run wp commands like wp acorn but I keep getting

Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This error happens even if I try to run wp plugin list seems like WSL2 is having an issue with DB_HOST or something.

Below is my wp --info

OS: Linux 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64
Shell: /usr/bin/zsh
PHP binary: /usr/bin/php7.4
PHP version: 7.4.30
php.ini used: /etc/php/7.4/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.0.30-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /mnt/c/Users/Ryan/Local Sites/kme-cnc/app/public/wp-content/themes/knc
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0

So I installed the php-mysql extension and now I am seeing the following error when running wp commands in wsl2.

Error: Error establishing a database connection.

My DB is set to

define( ‘DB_HOST’, ‘localhost’ );