psql.exe-Windows中的密码身份验证失败
我是PostgreSQL的菜鸟。我在Windows7上安装了9.2版。在安装过程中,它要求输入密码,然后我输入了密码。
现在,每当我运行d:\tools\PostgreSQL9.2\bin\psql.exe时,它都会要求输入密码。当我输入密码时,它不接受,而
则显示用户 user1的密码验证失败。我已经重新安装了两次。我也尝试输入系统
密码。
I'm a noob in PostgreSQL. I installed ver 9.2 on windows7. During installation it asked for password and i entered it. Now whenever i run d:\tools\PostgreSQL9.2\bin\psql.exe it asks for password. When i enter the password it doesn't accept and it shows "password authentication failed for user "user1". I have re-installed twice already. Also i tried entering my system password.
我正在尝试使以下命令正常工作
I'm trying to get the below command to work
psql.exe -f db/codedb.sql development
我应该怎么做才能使其正常工作?
What should i do to get this working ?
尝试在连接时设置用户名。
Try setting the user name when connecting.
psql.exe -U username -d dbname -f somefile.sql
您可能已经设置默认的 postgres用户。不确定是否创建了其他用户。
You've probably set up the default "postgres" user during installation. Not sure if you've created any others.
要添加其他用户和数据库,只需以postgres身份连接到postgres数据库,然后执行以下操作:
To add other users and databases just connect to as postgres to the postgres database and do something like:
CREATE USER myuser WITH ENCRYPTED PASSWORD 'secret';
CREATE DATABASE mydb OWNER myuser;
如果您的计算机是为了安全起见,您可能还想设置一个密码文件
If your machine is secure you might also like to set up a password file