我正在使用postgresql在节点中构建一个api。我正在使用sequelize作为ORM。当我运行以下命令来创建数据库时:
createdb bookstore
我遇到以下错误:
createdb: could not connect to database template1: FATAL: role "ubox18" does not exist
下面是我的配置文件:
{
"development": {
"username": "postgres",
"password": "postgres",
"database": "bookstore",
"port": 5432,
"host": "127.0.0.1",
"dialect": "postgres"
},
"test": {
"username": "postgres",
"password": "postgres",
"database": "database_test",
"host": "127.0.0.1",
"dialect": "postgres"
},
"production": {
"username": "postgres",
"password": "postgres",
"database": "database_production",
"host": "127.0.0.1",
"dialect": "postgres"
}
}
有人可以帮助我在这里丢失的内容吗?
答案 0 :(得分:1)
尝试:
createdb -U postgres bookstore
除非您选择带有选项-U的另一个数据库用户,否则“ createdb”实用程序将从OS用户中选择数据库用户。