标签: postgresql

“致命:锁定文件“postmaster.pid”已经存在”

我刚刚通过以下方式重新安装了 postgres brew install postgres

我跑了initdb /usr/local/var/postgres -E utf8但得到了这个:

The files belonging to this database system will be owned by user "atal421".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an …
Run Code Online (Sandbox Code Playgroud)

macbook database postgresql homebrew macos

87
推荐指数
4
解决办法
12万
查看次数

在 Mac OS 上安装 libpq-dev?

有谁知道如何在 Mac OS 10.6 上安装libpq-dev?这是我要安装的其他东西的先决条件。

似乎没有它的 macport,那么我如何在 Mac 上安装它?

mac postgresql

34
推荐指数
3
解决办法
6万
查看次数

防止 Postgresql 在启动时运行

在过去的某个时候,我安装了 posgresql 并且无法摆脱它:

$ ps -A|egrep postg   232 ??        
287 ??         0:00.02 postgres: logger process                                                                                                                                                                                                                       
328 ??         0:00.09 postgres: writer process                                                                                                                                                                                                                       
335 ??         0:00.06 postgres: wal writer process                                                                                                                                                                                                                   
336 ??         0:00.03 postgres: autovacuum launcher process                                                                                                                                                                                                          
342 ??         0:00.01 postgres: stats collector process 
Run Code Online (Sandbox Code Playgroud)

我想在每次启动时阻止它启动,因为fs_usage它显示我的磁盘一直被占用。

我已经尝试添加POSTGRES=-NO-in /etc/hostconfig,但过程不断产生。

我也尝试过在另一篇文章中找到的东西,但没有运气:

$: locate postg|egrep plist
/Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist
/Library/PostgreSQL/8.3/uninstall-postgresql.app/Contents/Info.plist
/Library/PostgreSQL/8.4/uninstall-postgresql.app/Contents/Info.plist
/Library/StartupItems/postgresql-8.3/StartupParameters.plist

$: sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-8.4.plist

(restart)
Run Code Online (Sandbox Code Playgroud)

但仍然显示 postgresql 进程:(

mac postgresql

33
推荐指数
3
解决办法
3万
查看次数

如何使用 PostgreSQL 修复“库未加载:libssl.1.0.0.dylib”?

删除 Macports 后,我有一些奇怪的行为。当我尝试通过 CLI 运行 PostgreSQL 时,我得到:

pawel:~ pawel$ psql
dyld: Library not loaded: /opt/local/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/bin/psql
  Reason: image not found
Trace/BPT trap
Run Code Online (Sandbox Code Playgroud)

这很奇怪,因为我已经通过 Homebrew 安装了 Postgresql 并运行brew list确认它在那里。我如何让 psql 再次工作?

此外,由于错误,尝试安装pg gem失败file not found: /opt/local/lib/libssl.1.0.0.dylib。我需要让 Postgres 不在 /opt/local/ 目录中查找此文件。

mac postgresql macports homebrew

27
推荐指数
1
解决办法
6万
查看次数

创建 PostgreSQL DB 的用户权限

我在 Ubuntu 上工作。以下是我的命令之一。

$ psql -U kuser -d postgres
Run Code Online (Sandbox Code Playgroud)

然后这将连接到数据库。但是当我尝试时从 postgres 终端

postgres=> CREATE DATABASE kdb;
ERROR:  permission denied to create database
Run Code Online (Sandbox Code Playgroud)

当我在 Ubuntu 中尝试类似的命令时,它给出了以下内容

$ sudo -u kuser createdb kdb
sudo: unknown user: kuser
sudo: unable to initialize policy plugin
Run Code Online (Sandbox Code Playgroud)

我如何创建这个数据库?。我有 sudo 权限,而 kuser 不是我。

postgresql

25
推荐指数
1
解决办法
4万
查看次数

如何在 PostgreSQL 9.2.6 + CentOs 中执行/运行 .sql 文件

我想知道如何在 PostgreSQL 中执行 .sql 文件。我正在使用 CentOs 6.4。

我已经创建了一个数据库,只需要运行给我的脚本来创建表。

提前谢谢你。

postgresql centos-6

25
推荐指数
3
解决办法
13万
查看次数

尝试启动通过 Homebrew 安装的 PostgreSQL 时出错:“不允许操作”

我最近通过Homebrew在我的 Mac 上安装了 PostgreSQL 。(我可能已经安装了它;它没有运行。)

brew install postgres
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Run Code Online (Sandbox Code Playgroud)

现在我试图用它开始launchctl

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Run Code Online (Sandbox Code Playgroud)

...但我收到一个错误:

/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist:不允许操作

这个错误是什么意思?我究竟做错了什么?我该如何解决这个问题?

postgresql macos

25
推荐指数
1
解决办法
1万
查看次数

PostgreSQL homebrew 安装缺少配置文件

所以我在 MacOSX Lion 上成功安装了 PostgreSQL 9.1。与人们说的不同,我不必更改 PATH 并且系统上没有安装其他版本的 PostgreSQL($ psql --version 显示psql (PostgreSQL) 9.1.4)。

但是,当我尝试使用pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start它运行服务器时,它不起作用。首先,它说不存在目录/usr/local/var/postgres/。很好,创建了一个。然后它说权限是错误的 - 好吧,改变它们。然后它要求postgresql.conf文件在这个目录中。

现在,我在 中找到了示例配置/usr/local/Cellar/postgresql/9.1.4/share/postgresql,但我不确定这是否应该是这样。我在网上看到的所有手册都没有提到从样本中创建配置文件。自制软件不应该开箱即用,以便我立即启动服务器吗?

postgresql homebrew osx-lion macos

23
推荐指数
1
解决办法
3万
查看次数

如何使用 LibreOffice Base 连接到 PostgreSQL 服务器?

当我尝试使用 LibreOffice Base 3.5 连接到本地计算机上的 PostgreSQL 服务器时遇到错误(这也适用于 LibreOffice 4):

LibreOffice Base 数据源选择

以下语法 ( localhost:5432=<database name>; 数据库名称worktime) 不起作用:

在此处输入图片说明

当我尝试在下一页测试连接时,出现以下错误:

数据库 URL 错误 'sdbc:postgresql:localhost:5432=localhost':
无效的连接选项“localhost:5432”

数据源 URL 的正确语法是什么?

postgresql libreoffice-base

18
推荐指数
2
解决办法
4万
查看次数

在不选择任何数据库的情况下调用 psql 命令

psql命令行客户端的语法是

psql [option...] [dbname [username]]
Run Code Online (Sandbox Code Playgroud)

我将命令传递ALTER DATABASE x RENAME to y给这个命令:

echo `ALTER DATABASE x RENAME to y` | psql
Run Code Online (Sandbox Code Playgroud)

目前我收到错误

psql: FATAL:  database "myuser" does not exist
Run Code Online (Sandbox Code Playgroud)

看起来该psql命令试图打开与当前用户名同名的数据库。

如何在psql不选择任何数据库的情况下启动命令?

编辑

解决方法当然只是为用户创建一个空数据库。

使用数据库x作为参数不起作用,因为这会阻止重命名。

postgresql

16
推荐指数
1
解决办法
8432
查看次数