我正在使用 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/