远程mysql:如何在Windows 10中设置远程mysql Server
//下面的新更新
我刚刚发布了一个用于早期Alpha测试的应用程序,但正在获取此错误=> 地址:“ 127.0.0.1”代码:“ Econnrefused” Errno:-111致命端口:True Port:3306 Syscall:“ Connect”
。我已经搜索并发现这是因为MySQL除了Localhost之外不允许连接。再次搜索后,我遇到了这两个教程( 1st )( 2nd ),但遇到了一些麻烦,但仍然无法正常工作。我的前端是[此处] [3],服务器是[此处] [4](已删除)。 。\ mysql.exe -u用户名-h root -p。替换MNHS-SHSHS.HEROKUAPP.com
mysql:它说[警告]使用命令行接口上的密码可能是不安全的。
。 的服务器步骤连接到数据库
它没有错误,但我仍然无法通过我执行
- : seT bind -address = 0.0.0.0
- 停止并启动mySQL80
- 配置的防火墙
- 试图连接。 -p。替换MNHS-SHSHSHS.HEROKUAPP.COM
- 创建用户'username'@'mnhs-shshshshshshshshshshshshshshshshshshshshshshshshs.herokuapp.com'由'password'确定;
- 授予创建,更改,删除,插入,更新,删除,选择,参考,重新加载,。,添加到'username'@'mnhs-shshshshshshshshshshs.herokuapp.com',并带有赠款选项;
- ...仍在前端
我已经连接到数据库
const mysql = require('mysql')
const connection = mysql.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
})
module.exports = connection
.env
DB_HOST=remotemysql.com
更新:我将哪个作为服务器?来自此 site 的代码
从那里,键入。\ mysql.exe -u用户名-h xxxx:xxxx -p。代替 XXXX:XXXX带有远程服务器IP地址和端口号(例如。 100.200.100.200:3306)和带有MySQL用户名的用户名允许远程访问(例如root)。遵循任何额外的屏幕 说明。
我只是从上方放了步骤4
// New Update Below
I just released an app for early alpha testing but am getting this error => address: "127.0.0.1" code: "ECONNREFUSED" errno: -111 fatal: true port: 3306 syscall: "connect"
. I've searched and found that this is because MySQL is not allowing connections aside from localhost. After searching again, I came across these two tutorials (1st) (2nd) but have run into some trouble and its still not working. My front end is [here][3] and the server is [here][4] (removed). After .\mysql.exe -u username -h root -p. Replace mnhs-shs.herokuapp.com
mysql: it says [Warning] Using a password on the command line interface can be insecure.
. It doesn't error but I still can't connect to the database by server
Steps I did:
- Set bind-address = 0.0.0.0
- stop and start MYSQL80
- Configured firewalls
- Tried to connect by .\mysql.exe -u username -h root -p. Replace mnhs-shs.herokuapp.com
- CREATE USER 'username'@'mnhs-shs.herokuapp.com' IDENTIFIED BY 'password';
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on . TO 'username'@'mnhs-shs.herokuapp.com' WITH GRANT OPTION;
- ... still error 111 on the front end
I'm already connected to the database by
const mysql = require('mysql')
const connection = mysql.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
})
module.exports = connection
.env
DB_HOST=remotemysql.com
Update: Which do I put as the server? Code from this site
From there, type .\mysql.exe -u username -h X.X.X.X:XXXX -p. Replace
X.X.X.X:XXXX with your remote server IP address and port number (eg.
100.200.100.200:3306) and username with a MySQL username that allows remote access (such as root). Follow any additional on-screen
instructions.
I just put in step 4 from above
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
弄清楚了。
对于未来的自我:
这不是Localhost唯一的错误。
.env,Gitignore和Dotenv模块如果要部署到Heroku,则不够。
Heroku Config vars使其正常工作,请参阅下面的链接。
https://devcenter.heroku.com/articles/articles/config-vars 。
Figured it out.
For future self:
It's not the localhost only error.
.env, gitignore and dotenv module is not enough if one is going to deploy to heroku.
Heroku config vars makes it work, refer to the link below.
https://devcenter.heroku.com/articles/config-vars.