gpt4 book ai didi

mysql - 没有互联网连接,数据库无法连接

转载 作者:行者123 更新时间:2023-11-30 22:36:59 26 4
gpt4 key购买 nike

我在使用 Xampp mysql 数据库和 SailsJS 时遇到这个问题。我的应用程序在本地运行,连接代码如下:

someMysqlServer: {
adapter: 'sails-mysql',
host: "localhost",
user:"root",
port : '3306',
database: 'school'
}

当我没有互联网连接启动Xamp控制面板时,它运行良好,甚至请求 http://localhost 也正在连接到 phpmyadmin,但我的 sails 控制台显示

error: A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
: Could not connect to MySQL:
Error: getaddrinfo ENOENT
at afterwards (D:\SchoolProject\node_modules\sails- mysql\lib\connections\spawn.js:72:13)
at D:\SchoolProject\node_modules\sails-mysql\lib\connections\spawn.js:40:7
at Handshake.onConnect (D:\SchoolProject\node_modules\sails-mysql\node_modules\mysql\lib\Pool.js:54:9)
at Handshake.Sequence.end (D:\SchoolProject\node_modules\sails-mysql\node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24)
at Protocol.handleNetworkError (D:\SchoolProject\node_modules\sails-mysql\node_modules\mysql\lib\protocol\Protocol.js:355:14)
at PoolConnection.Connection._handleNetworkError (D:\SchoolProject\node_modules\sails-mysql\node_modules\mysql\lib\Connection.js:367:18)
at Socket.emit (events.js:107:17)
at net.js:950:16
at process._tickDomainCallback (node.js:381:11)

虽然同一个应用程序适用于互联网连接。请问我想不出这个问题吗?????

最佳答案

将主机:“localhost”替换为主机:“127.0.0.1”我认为它会起作用。

关于mysql - 没有互联网连接,数据库无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32275778/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com