database - postgreSQL 错误 initdb : command not found

标签 database postgresql ubuntu

我正在使用 linuxbrew 在 ubuntu 上安装 postgresql:

brew install postgresql

它似乎工作正常但在那之后因为我第一次安装 PostgreSQL 我尝试创建一个数据库:

initdb /usr/local/var/postgres -E utf8

但它返回为:

initdb: command not found

我尝试使用 sudo 运行命令,但这没有帮助

最佳答案

运行 locate initdb 它应该会为您提供可供选择的列表。像:

MacBook-Air:~ vao$ locate initdb
/usr/local/Cellar/postgresql/9.5.3/bin/initdb
/usr/local/Cellar/postgresql/9.5.3/share/doc/postgresql/html/app-initdb.html
/usr/local/Cellar/postgresql/9.5.3/share/man/man1/initdb.1
/usr/local/Cellar/postgresql/9.6.1/bin/initdb
/usr/local/Cellar/postgresql/9.6.1/share/doc/postgresql/html/app-initdb.html
/usr/local/Cellar/postgresql/9.6.1/share/man/man1/initdb.1
/usr/local/bin/initdb
/usr/local/share/man/man1/initdb.1

所以在我的例子中我想运行

/usr/local/Cellar/postgresql/9.6.1/bin/initdb 

如果您没有安装 mlocate,请安装它或使用

sudo find / -name initdb

关于database - postgreSQL 错误 initdb : command not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44104241/

相关文章:

python - SQL SELECT 来自变量提供的表名

sql - PL/SQL 触发器 : can't create apex user

python - 从 executemany 语句中获取 'return' d 值

sql - 两个表之间的文本字段最接近匹配 : how to improve plpgsql function

postgresql - 为什么不能使用 "service postgres start"在 docker 中启动 postgres?

Javafx 应用程序在一段时间后自动崩溃

php - 寻找有关使用 SMS 更新在线数据库的建议

linux - 每次通过 ftp 上传新文件时都使用相同的名称解压文件

python - 运行分离的 Bokeh 服务器

python - 在 Python 中将 xbee 源地址存储到数据库中