Home >Database >Mysql Tutorial >How to access Mysql through SSH tunnel forwarding

How to access Mysql through SSH tunnel forwarding

藏色散人
藏色散人forward
2020-03-12 08:43:332495browse

Access Mysql through SSH channel forwarding

Scenario:

Mysql服务器: test.cn
    Mysql_Listen: 127.0.0.1:3306
    SSH_Port: 8888
Client : local.cn

SSH channel forwarding

ssh -fNg -p 8888 -L 3306:127.0.0.1:3306 User@test.cn

Check whether there is a local 3306 port Monitor

ss -lntp |grep '3306'

Mysql Client connection

mycli -h localhost -P 3306 -u user -p password

Recommended mysql video tutorial, address: https://www.php.cn/course/list/51.html

The above is the detailed content of How to access Mysql through SSH tunnel forwarding. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete