Postgres:psql:致命:数据库“root”在 Windows 10 中不存在

Rag*_*ani 2 postgresql postgresql-11

请检查我运行的以下命令:

C:\Windows\system32>psql -U root
Password for user root:
psql: FATAL:  database "root" does not exist

Run Code Online (Sandbox Code Playgroud)

Lau*_*lbe 8

如果没有明确指定要连接哪个数据库,psql将使用与数据库用户同名的数据库。

由于您指定了数据库用户rootpsql因此尝试连接到该名称的数据库,但该数据库不存在。

尝试指定现有数据库:

psql -U root -d mydb
Run Code Online (Sandbox Code Playgroud)

如果您不知道要使用哪个数据库,或者您从未创建过数据库,您始终可以使用该postgres数据库。