Home > Database > Mysql Tutorial > body text

Connect MySQL Workbench to MySQL Server in WSL using Node

Susan Sarandon
Release: 2024-11-15 01:34:02
Original
204 people have browsed it

Windows Subsystem for Linux(WSL) is a Microsoft Windows feature that lets you run a Linux environment directly on your Windows machine without needing a separate virtual machine or dual booting your PC.

WSL uses your window's system IP address as it's own. However, the default MySQL workbench config only accepts requests and connections from 127.0.0.1

If you want to connect your NodeJS app to MySQL workbench, then you need to use the ip address of your host machine(PC). To do this, follow these steps:

  • Open your WSL terminal.

  • Run the following command in your WSL terminal to retrieve your host machine's(PC's) IP address:

ip route show | grep -i default | awk '{ print $3}'

Connect MySQL Workbench to MySQL Server in WSL using Node

  • On your .env file, change the DB_HOST(the variable which stores your host IP Address) to your host machine's IP Address

Connect MySQL Workbench to MySQL Server in WSL using Node

Now, your NodeJS server is running and ready for use:

Connect MySQL Workbench to MySQL Server in WSL using Node

To learn more about how to access your PC's network applications through WSL, read the following article on Microsoft learn: Accessing network applications with WSL

The above is the detailed content of Connect MySQL Workbench to MySQL Server in WSL using Node. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template