在PostgreSQL中,输入密码后按Enter键,为什么命令行窗口消失了? [英] In PostgreSQL why does command line window disappear when I press Enter after entering my password?

查看:174
本文介绍了在PostgreSQL中,输入密码后按Enter键,为什么命令行窗口消失了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天在笔记本电脑上(运行Windows 10)安装了PostgreSQL,并且试图开始学习SQL。 PostgreSQL安装教程说可以通过打开psql.exe尝试使用命令提示符进行连接,所以我做到了,得到了命令窗口,并要求我输入密码。我输入了内容并按Enter键-窗口消失了。多次。密码绝对正确。



我做错了什么?我一直在寻找有关此问题的信息,但没有找到答案。我只是想确保我的设置正确无误,随时可以使用。



感谢任何建议。



登录时使用以下命令:
C:\Program Files\PostgreSQL\12\bin> psql.exe -d postgres -U postgres


I installed PostgreSQL on my laptop today (running Windows 10) and I am trying to get started learning SQL. The PostgreSQL Installation Tutorial said to try connecting using command prompt, by opening psql.exe, so I did that, got the command window, and it asked me for my password. I entered that and pressed the Enter key -- and the window disappeared. Multiple times. The password is definitely correct.

What did I do wrong? I've looked hard for info about this but have not found answers. I'm just trying to be sure my setup is correct and ready to go.

Thanks for any suggestions.

解决方案

I faced the same issue and the reason is by default the SQL connection uses windows username(the user with which you are logged in) while this user is not created on the DB.

Use the following command while login: C:\Program Files\PostgreSQL\12\bin>psql.exe -d postgres -U postgres

这篇关于在PostgreSQL中,输入密码后按Enter键,为什么命令行窗口消失了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆