一、在购买的云服务器上设置mysql的远程连接(如:腾讯云主机、阿里云主机等)
①、在phpmyadmin中,用root账号登陆,把root账号设置为“任意主机”
②、此时,已经设置好了mysql远程连接了,已discuz论坛程序为例来安装,如出现下图错误时,表示服务器防火墙没有放行“3306”端口,可以在防火墙上放行此端口,或关闭防火墙,即可解决这个问题。
二、在本地假设的服务器,用ngrok反向代理到公网上,设置mysql的远程连接
①、按照“一”里面的两个步骤设置好
②、在ngrok.cfg配置文件中加入tcp变量
remote_port: 5000 proto: tcp: 127.0.0.1:3306
5000端口自行修改
例子:
server_addr: "ngrok.veelove.cn:443" tunnels: web: hostname: "test.veelove.cn" proto: http: 127.0.0.1:80 web1: hostname: "admin.veelove.cn" proto: http: 127.0.0.1:8888 mysql: remote_port: 5000 proto: tcp: 127.0.0.1:3306
Hey, thanks for the article post.Much thanks again. Want more.