我按照这个文件http://www.postgresql.org/download/linux/ubuntu/上的安装,一切似乎没问题.但是,当我尝试按照本教程:http://www.postgresql.org/docs/9.3/static/tutorial-createdb.html时,一切都不再好了.这是我尝试创建数据库表时遇到的错误:
$ createdb mydb
WARNING: password file "/home/.../.pgpass" has group or world access; permissions should be u=rw (0600) or less
WARNING: password file "/home/.../.pgpass" has group or world access; permissions should be u=rw (0600) or less
createdb: could not connect to database template1: FATAL: role "..." does not exist
$ /usr/local/pgsql/bin/createdb mydb
bash: /usr/local/pgsql/bin/createdb: No such file or directory
Run Code Online (Sandbox Code Playgroud)
小智 9
你有一个警告和一个错误.
您可以通过终端中的此命令行处理警告:
$ chmod 600 ~/.pgpass
Run Code Online (Sandbox Code Playgroud)当您在终端中编写"psql"时,Postgres DBMS会尝试使用您的计算机名称连接到一个数据库,但无法找到它.另一方面,Postgrest在安装时会创建一个名为"postgres"的数据库,因此请尝试连接到此并创建数据库.您可以使用以下命令轻松连接到"postgres"数据库:
$ psql postgres
Run Code Online (Sandbox Code Playgroud)如果你得到"Unix域套接字上的连接"/tmp/.s.PGSQL.5432"?" 使用以下命令启动数据库错误:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Run Code Online (Sandbox Code Playgroud)使用以下命令检查结果:
$ pg_ctl -D /usr/local/var/postgres status
Run Code Online (Sandbox Code Playgroud)错误消息告诉您出了什么问题。更改权限.pgpass
:
chmod u=rw $HOME/.pgpass
Run Code Online (Sandbox Code Playgroud)
Also, unless you edited the error message and didn't say so, you appear to actually be attempting to connect as user ...
. I imagine the examples you read said something like:
psql -U "..." template1
Run Code Online (Sandbox Code Playgroud)
and assumed you'd replace "..." with the actual username.
归档时间: |
|
查看次数: |
4138 次 |
最近记录: |