我在公司环境中(运行Debian Linux)并没有自己安装它.我使用Navicat或phpPgAdmin访问数据库(如果有帮助的话).我也没有shell访问运行数据库的服务器.
我正在设置我的PostgreSQL 9.1.我对PostgreSQL无能为力:不能createdb,不能createuser; 所有操作都返回错误消息
Fatal: role h9uest does not exist
Run Code Online (Sandbox Code Playgroud)
h9uest是我的帐户名,我sudo apt-get install在这个帐户下的PostgreSQL 9.1.
该root帐户仍然存在类似的错误.
我正在使用PostgreSql应用程序的mac(http://postgresapp.com/).我以前在其他机器上使用它但是在我的macbook上安装时给我带来了一些麻烦.我安装了应用程序,然后运行:
psql -h localhost
Run Code Online (Sandbox Code Playgroud)
它返回:
psql: FATAL: database "<user>" does not exist
Run Code Online (Sandbox Code Playgroud)
似乎我甚至无法运行控制台来创建它试图找到的数据库.我跑的时候会发生同样的事情:
psql
Run Code Online (Sandbox Code Playgroud)
或者如果我从应用程序下拉菜单中启动psql:
机器统计:
OSX 10.8.4
psql(PostgreSQL)9.2.4
任何帮助表示赞赏.
我也试图通过自制软件安装PostgreSql,我遇到了同样的问题.我还阅读了应用程序文档页面,其中说明:
当Postgres.app首次启动时,它会创建$ USER数据库,当没有指定时,它是psql的默认数据库.默认用户是$ USER,没有密码.
所以似乎应用程序没有创建$ USER但是我已经安装了 - >卸载 - 重新安装了几次,所以它必须是我的机器的东西.
我找到答案,但我不确定它是如何工作的,因为在这个线程上回答的用户 - > 获取Postgresql在Mac上运行:数据库"postgres"不存在没有跟进.我使用以下命令来打开psql:
psql -d template1
Run Code Online (Sandbox Code Playgroud)
我会留下这个答案,直到有人可以解释为什么这样做.
我使用自制软件在我的Mac(10.10.1/Yosemite)上安装了Postgresql 9.4.0.这是行不通的.
我在〜/ Library/LaunchAgents中创建了/usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist的软链接.
如果我尝试手动加载postgres,我会收到"正在进行操作"的消息
> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress
Run Code Online (Sandbox Code Playgroud)
然而,postgres似乎没有运行.
> ps auxw | grep post
billmcn 670 0.0 0.0 2424272 452 s000 R+ 10:12PM 0:00.01 grep post
Run Code Online (Sandbox Code Playgroud)
我无法连接命令行客户端.
> psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
据我所知,我已经尝试了其他 Stackoverflow线程上建议的所有修复程序来讨论这个问题.特别:
我之前确实有Homebrew postgres在这台机器上工作.我认为破坏它的是从版本8升级到版本9,但我不确定.
我没有任何需要保留的数据库.我愿意用postgres开始清洁; 我现在只需要让它上班.有任何想法吗?
该问题似乎是/ usr/local/var/postgres目录的权限.这是我的var目录在事情不起作用时的样子.
ll /usr/local/var/
drwxr-xr-x 3 …Run Code Online (Sandbox Code Playgroud) 我尝试创建一个名为postgres的用户.我重新安装了postgres brew.我能用它来运行它
postgres -D /usr/local/var/postgres
当我跑步时mix ecto.create,我仍然得到错误:
~/code/blog_phoenix:.mix ecto.create
** (Mix) The database for BlogPhoenix.Repo couldn't be created, reason given: psql: FATAL: role "postgres" does not exist.
~/code/blog_phoenix:.
Run Code Online (Sandbox Code Playgroud) 我在尝试创建数据库时遇到错误.我安装了postgres,我已经成功完成了一些测试项目.而且,我没有看到这个错误.任何帮助都会很棒:
错误:
~/Desktop/elixir/restore $ mix ecto.create
** (Mix) The database for Restore.Repo couldn't be created: tcp connect: connection refused - :econnrefused
21:52:23.978 [error] GenServer #PID<0.150.0> terminating
** (Postgrex.Error) tcp connect: connection refused - :econnrefused
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:623: Connection.enter_connect/5
(stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
Run Code Online (Sandbox Code Playgroud) 我有第三次或第四次这个问题,重新启动我的Mac(优胜美地和以前的OSX版本相同)postgres服务器无法启动.我在这个链接后安装了我的postgres .知道为什么每次重启后这种情况一直发生吗?
打字psql就给了
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud) 我正在设置 Postgresql 以与 Rails 应用程序一起使用,但我似乎无法连接或正确配置数据库(启动 Rails 服务器后出现的错误是:ActiveRecord::NoDatabaseError和could not translate host name "MyProfile" to address: nodename nor servname provided, or not known)。
我从我需要切换到或创建“MyComputer”角色的有关此主题的数十个其他问题中收集到,但是我注意到它们都需要使用该psql命令。当我psql再次运行时,我再次收到错误FATAL: role "MyProfile" does not exist。
到目前为止,我一直在关注Heroku的INSTAL过程,我坚持在这里(或者更准确地说这里,安装,在Heroku上说,运行后psql -h localhost即可工作)。我是否在这里遗漏了一个明显的步骤/做错了什么?
我也尝试过:尝试
创建此卷/用户的
sudo su - MyProfile
变体sudo -u postgres createuser owning_user
和其他几个命令,但我似乎无法完成解决问题所需的工作。
编辑
我也运行过ps aux | grep postgres,看起来所有与 postgres 相关的 PID 都在“MyProfile”下运行(假设我没看错)。但是 psql 命令仍然返回该角色不存在。#悲伤的脸
编辑 2
我刚刚打开 Postgres 应用程序并单击“打开 psql”按钮。它打开了终端,运行了一个命令 ( …