floreap's avatar

How to connect mysql WSL with Windows 11 GUI client?

I followed ChatGPT steps and got into this...

ipconfig

Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.100.2
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.100.1

Ethernet adapter vEthernet (WSL (Hyper-V firewall)):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::19ba:da1:a410:74fd%19
   IPv4 Address. . . . . . . . . . . : 172.31.128.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

.env

DB_CONNECTION=mysql
DB_HOST=192.168.100.2
DB_PORT=3306
DB_DATABASE=ecommerce
DB_USERNAME=developer2
DB_PASSWORD=pw

my.ini

bind: 192.168.100.2

I go to WSL project directory and call php artisan migrate getting:

  could not find driver (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'ecommerce' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)
0 likes
3 replies
JussiMannisto's avatar

Have you installed all the required PHP extensions in WSL? You can check installed extensions by running php -m.

I think you also need the pdo_mysql extension to use mysql.

1 like
hajrovica's avatar

as @jussimannisto sasid by error mesage you are missing required extension.

In your php.ini configuration file simply uncomment the extension:

;extension=php_pdo_mysql.dll

php --ini to see lodaded ini files

1 like

Please or to participate in this conversation.