最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

'错误:Node.js中的数据库“root”不存在

IT培训 admin 5浏览 0评论

'错误:Node.js中的数据库“root”不存在

我正在运行与Postgres数据库对话的NodeJS微服务。但是,当我尝试启动服务时,我遇到了错误。我不知道为什么会出现这个错误。

错误:

   UnhandledPromiseRejectionWarning: Unhandled promise rejection(rejection id:1): error: database “root” does not exist

我的DB连接细节:

  const pg = require(“pg”);
  const client = new pg.Client({
            host: “txslmxxxda6z”,
            user: “mom”,
            password: “mom”,
            db: “mom”,
            port: 5025
  });
回答如下:

我自己能解决这个问题。问题出在连接配置中。它应该是数据库而不是数据库,因此这导致了问题。 PFB回答

 const client = new pg.Client({
        host: “txslmoxxx6z”,
        user: “mom”,
        password: “mom”,
        //change db to database
        database: “mom”,
        port: 5025
 });

'错误:Node.js中的数据库“root”不存在

我正在运行与Postgres数据库对话的NodeJS微服务。但是,当我尝试启动服务时,我遇到了错误。我不知道为什么会出现这个错误。

错误:

   UnhandledPromiseRejectionWarning: Unhandled promise rejection(rejection id:1): error: database “root” does not exist

我的DB连接细节:

  const pg = require(“pg”);
  const client = new pg.Client({
            host: “txslmxxxda6z”,
            user: “mom”,
            password: “mom”,
            db: “mom”,
            port: 5025
  });
回答如下:

我自己能解决这个问题。问题出在连接配置中。它应该是数据库而不是数据库,因此这导致了问题。 PFB回答

 const client = new pg.Client({
        host: “txslmoxxx6z”,
        user: “mom”,
        password: “mom”,
        //change db to database
        database: “mom”,
        port: 5025
 });
发布评论

评论列表 (0)

  1. 暂无评论