且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法通过 localhost 将谷歌应用程序脚本连接到 mysql

更新时间:2023-02-04 21:56:21

好的,如果您在家中执行此操作并想在笔记本电脑上运行 google 应用脚本,请按照以下步骤操作您的本地 MYsql 数据库:-

Okay so if you are doing this from your home and want to run google app scripts your local MYsql database on your laptop follow the below steps:-

1) 将笔记本电脑上的端口 3306 暴露在互联网上.

1)Expose port 3306 on your laptop to the internet.

登录到您的路由器并将 3306 端口转发到您的笔记本电脑:-如果您拥有 netgear 路由器,这是一个简短的 *** 视频.基本上你在这里做的是;当谷歌服务器上运行的谷歌脚本试图找到您的数据库时,它会在端口 3306 ***问路由器(公共 IP).现在,此请求从那里被路由到您的特定笔记本电脑.示例端口转发视频:-端口转发视频

Login to your router and port forward the 3306 port to your laptop:- Here is a short *** video if you own a netgear router. Basically what you are doing here is; when the google script running on the google servers tries to locate your database it hits the router(public IP) on port 3306. Now from there this request gets routed to your specific laptop.Example port forwarding video:- Port Forwarding Video

2) 在任何计算机上向具有 用户名密码 的任何人开放 MYSql 数据:-在您的 MySQL 数据库上运行以下命令:-

2)Open up the MYSql data to anybody with a username and password from any computer:- run the following command on your MySQL database:-

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

3) 在以下行中使用您的公共 IP:-所以而不是var conn = Jdbc.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root","");使用以下

3)Use your public IP in the following line :- So instead of var conn = Jdbc.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root",""); use the following

var conn = Jdbc.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root","");

以防万一您像大多数人一样遇到 IPV6 和 JDBC 兼容性问题.从以下地址获取您的公共 IP:-获取我的 IPV4 地址

Just in case you face IPV6 and JDBC compatibility issues like most will. Get your public IP from the following address:- get my IPV4 address

所以不要使用 127.0.0.1,而是使用上述谷歌查询的结果

So instead of 127.0.0.1 use the results from the above google query