Get the App
SLTechnology News&Howtos  ›  Database  › 

Windows system vscode remote debugging mysql

Shulou Source: shulou.com Published: 2022-06-01 06:07:57 09月28日 Update

Preparatory work

The goal of this article is to remotely access Linux's mysql source code from the Windows VSCode environment and perform GDB remote debugging.

First prepare the following software

On the local machine:

Install the latest version of VSCode to support the Remote-Development plug-in install the VSCode extension "Remote-Development" by managing (⚙)-> extension in the lower left corner, directly search the store to install the OpenSSH-compatible SSH client, and I installed Git for Windows

On the remote machine:

Compile and install mysql (note that you need to turn on-DWITH_DEBUG=1 when compiling), and start the mysql instance. Here I compile and install mysql8.0.18 on centos (CentOS Linux release 7.7.1908) (for the convenience of readers who have no experience in mysql8.0.18 compilation and installation, write another mysql8.0.18 compilation and installation article)

Install gdb, yum install gdb

When gdbserver is installed, yum install gdb-gdbserver starts the ssh server, which usually starts using VSCode remote access code by default.

VSCode main screen View-> expand the search for "Remote-Development" and install it. After successful installation, there will be a computer icon on the left.

First, change the settings, manage (⚙)-> Settings in the lower left corner, search "remote.SSH", and check remote.SSH.showLoginTerminal.

After that, you can connect to the remote machine. To avoid entering passwords frequently, it is recommended to use secret-free ssh login.

First generate the key:

# generate a pair of keys, the file name is vscode_rsassh-keygen-t rsa# public key needs to be placed in the Linux execution environment # the public key is "vscode_rsa.pub" cat / root/.ssh/vscode_rsa.pub > > / root/.ssh/authorized_keyschmod 644 / root/.ssh/authorized_keys# private key is placed in the Windows machine at one end of the VSCode # my path is "D:/dba/vscode_rsa"

Then select Remote.SSH: Open Configuration File on the VSCode main interface ctrl+shift+p, and enter the following:

Host vm-mysql

Tags: Machine path compilation code input success file source code environment interface command instance generation management configuration public key function key directory target Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Information Linux Redmi NVidia