记一次mysql 3306端口映射到外网 frp

FRP 安装必要条件

  1. 公网IP
  2. FPR 客户端,服务端软件版本一致

公网IP可以直接购买云服务器,一般学生和首单都是很换算的。文章结尾附阿里云,腾讯云连接!

有问题直接留言,尽己所能!

启动命令

通过下面命令启动被访问机器的frp

nohup ./frps -c ./frps.toml  &

记一次mysql 3306端口映射到外网

  • mysql本身没有配置远程访问

  • frp配置错误,没注意中文单引号和英文单引号的区别

mysql本身没有配置远程访问

问题 navacat 远程链接mysql 出现 Lost connection to MySQL server at ‘reading initial communication packet’的解决办法

分析应该是以下两个原因导致的:

服务器有防火墙,禁止3306端口的访问。
用户没有授权远程访问。

MySQL 8.x 设置允许远程访问

update user set host='%' where user='root';

#再执行两次

GRANT ALL ON *.* TO 'root'@'%';

# 所有操作后,应执行
flush privileges;

首先进入linux上的my.cnf。一般都是在/etc/my.cnf,如果没有则自行创建

把my.cnf里面的bind-address那一行注释掉,无论是bind-address=127.0.0.1还是bind-address=0.0.0.0,都把bind-address这行注释掉注释掉。

在my.cnf中加上skip-name-resolve

重启mysql服务:service mysql stop、service mysql start或者直接一句service mysql restart

rp配置错误,没注意中文单引号和英文单引号的区别

参考

内网穿透工具frp简单使用,访问内网机器指定端口 - 知乎

远程连接MySQL数据库失败2013-Lost connection to MYSQL server at ‘reading for initial communication packet‘_2013 - lost connection to mysql server at 'reading-CSDN博客

MySQL8.0设置远程访问权限 - 知乎

TCP & UDP | frp

负载均衡与健康检查 | frp

FRP 多端口配置,注意 要标题不同,frp 版本 0.52.3

# frpc.toml
[[proxies-test1]]
name = "test1"
type = "tcp"
localPort = 8080
remotePort = 80
loadBalancer.group = "web"
loadBalancer.groupKey = "123"

[[proxies-test2]]
name = "test2"
type = "tcp"
localPort = 8081
remotePort = 80
loadBalancer.group = "web"
loadBalancer.groupKey = "123"

服务器购买推荐

阿里云

腾讯云

猜你喜欢

转载自blog.csdn.net/qq_34068440/article/details/134688746
frp