我没有成功启动 postgres 服务器。我可以从终端向 postgres 添加新的数据库、表等,但不能通过网页向表中添加内容。该网页目前在本地主机上运行。
postgres 数据文件夹最初是在 root 用户中创建的,但我将其移至我自己的用户帐户并解决了很多问题,但我又回到了进入 postgres 后不断出现的旧错误 - D data
(数据为数据簇文件夹)
EDT LOG: could not bind IPv4 socket: Address already in use
2015-06-18 11:11:35 EDT HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2015-06-18 11:11:35 EDT LOG: could not bind IPv6 socket: Address already in use
2015-06-18 11:11:35 EDT HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2015-06-18 11:11:35 EDT WARNING: could not create listen socket for "*"
2015-06-18 11:11:35 EDT FATAL: could not create any TCP/IP sockets
我尝试了两个不同的命令来启动服务器。
pg_ctl -D data -l logfile start
这给了我这个,但它不正确
server starting
和
pg_ctl -D /Library/PostgreSQL/9.4/data -l log file start
这给了我这个
LOG: skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: another server might be running; trying to start server anyway
server starting
postgresql.auto.conf 文件绝对是正确的名称和一切。如果我尝试停止假定启动的服务器,它会导致我尝试的第一个命令中的第一个服务器和第二个命令中的第二个停止。
Is server running?
和
LOG: skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: could not send stop signal (PID: 83): Operation not permitted
最佳答案
某些东西似乎已经在使用端口 5432
。
尝试找出哪个程序(可能是 postgres 的另一个实例)正在阻塞该端口并决定是否停止该其他进程。
作为替代方案,重新配置 postgres 以使用其他端口。
也许您可以通过在控制台中输入以下内容来找出阻止该端口的原因:
lsof -n -i4TCP:5432 | grep LISTEN
关于macos - 启动 Postgres 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30941354/