-1

I am using latest Windows 11 build and installed WSL 2 (Debian) for development purpose. To try out a project, I need to install and configure MariaDB under my WSL Debian system. I have installed MariaDB 10.6.5 fine with no errors, but during initial setup process, I am having issues with connecting to MySQL. When I give following command:

sudo mysql_secure_installation

it's showing me error that
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

I also tried following command:

sudo mysql_secure_installation --protocol=tcp

But it's showing error again
ERROR 2002 (HY000): Can't connect to server on 'localhost' (115)

What's the issue here? How to connect with MySQL under WSL 2?

Note: I don't have MySQL/MariaDB installed under Windows host, only WSL (Debian) has it installed.

Abhi D.
  • 61
  • 1
  • 6
  • As I said, no MySQL client or anything on my windows machine. It's a freshly installed Windows machine and only WSL installed. I also tried the method of connecting with the IP of WSL (Debian) found by ifconfig, something like 172.31.xx.xx, but it also returns same error - ERROR 2002 (HY000): Can't connect to server on 172.31.xx.xx (115) – Abhi D. Jan 07 '22 at 17:40

1 Answers1

1

Problem solved after stating mariadb service, instead of mysql

sudo service mariadb start
Abhi D.
  • 61
  • 1
  • 6