您好,我在 nodejs 中制作了一个聊天应用程序,它在我的机器上运行良好,但是当我在我的 vps 上尝试它时,它总是在尝试连接到数据库时停止运行,这是我得到的错误日志
root@server:/etc/init.d# node /NodeJS/ChatServer/server.js
Server has started trying to connect to Database
Connection to Database has been made
events.js:85
throw er; // Unhandled 'error' event
^
Error: Connection lost: The server closed the connection.
at Protocol.end (/NodeJS/ChatServer/node_modules/any-db-mysql/node_modules/mysql/lib/protocol/Protocol.js:103:13)
at Socket.<anonymous> (/NodeJS/ChatServer/node_modules/any-db-mysql/node_modules/mysql/lib/Connection.js:102:28)
at Socket.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)