fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
86.46k stars 13.37k forks source link

forward mysql failed #4356

Closed wuyeguo closed 3 months ago

wuyeguo commented 3 months ago

Bug Description

config in frpc [[proxies]] name = "askxbot-mysql-tcp" type = "tcp" localIP = "172.16.1.141" localPort = 3037 remotePort = 37051

server for mysql is ok

mysql -h172.16.1.141 -P3307 -uxxxxx -pxxxxx

mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective

but when use frps

mysql -hxxxxxx -P37051 -uxxxxx -pxxxxx

mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

frpc Version

0.57.0

frps Version

0.57.0

System Architecture

Linux ecm-236c 5.4.0-190-generic #210-Ubuntu SMP Fri Jul 5 17:03:38 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Configurations

frps.toml

bindAddr = "0.0.0.0"
bindPort = 37000
kcpBindPort = 37000
tcpmuxHTTPConnectPort = 37001
vhostHTTPPort = 37002

auth.token = "***********"

# console or real logFile path like ./frps.log
log.to = "/service/frp/logs/frps.log"
# trace, debug, info, warn, error
log.level = "debug"
log.maxDays = 3
# disable log colors when log.to is console, default is false
log.disablePrintColor = false

webServer.addr = "127.0.0.1"
webServer.port = 37500
webServer.user = "*****"
webServer.password = "***********"

frpc.toml

serverAddr = "******"
serverPort = 37000

auth.token = "************"

[[proxies]]
name = "mysql-tcp"
type = "tcp"
localIP = "172.16.1.141"
localPort = 3037
remotePort = 37051

Logs

2024-07-29 16:19:11.685 [I] [proxy/proxy.go:204] [f6acd5fb9e1bfacf] [mysql-tcp] get a user connection [14.153.189.164:45728] 2024-07-29 16:19:11.685 [D] [server/control.go:272] [f6acd5fb9e1bfacf] get work connection from pool 2024-07-29 16:19:11.685 [D] [proxy/proxy.go:131] [f6acd5fb9e1bfacf] [mysql-tcp] get a new work connection: [14.153.189.164:40524] 2024-07-29 16:19:11.686 [D] [proxy/proxy.go:261] [f6acd5fb9e1bfacf] [mysql-tcp] join connections, workConn(l[10.0.0.49:37000] r[14.153.189.164:40524]) userConn(l[10.0.0.49:37051] r[14.153.189.164:45728]) 2024-07-29 16:19:11.732 [D] [server/control.go:243] [f6acd5fb9e1bfacf] new work connection registered 2024-07-29 16:19:11.732 [D] [proxy/proxy.go:271] [f6acd5fb9e1bfacf] [mysql-tcp] join connections closed

Steps to reproduce

  1. ...

Affected area

fatedier commented 3 months ago

Please do not submit questions about other application layers unless you are clearly aware that it is an issue caused by a bug in frp.