FINAL UPDATE: 最終更新: sql
I had forgotten to run the initdb
command. 我忘了運行initdb
命令。 服務器
< /FINAL UPDATE> </ FINAL UPDATE> post
by running this command 經過運行此命令 ui
ps auxwww | grep postgres
I see that postgres is not running 我看到postgres沒有運行 this
> ps auxwww | grep postgres remcat 1789 0.0 0.0 2434892 480 s000 R+ 11:28PM 0:00.00 grep postgres
this raises the question: How do I start the postgresql server? 這引出了一個問題:如何啓動postgresql服務器? spa
update: 更新: .net
>pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start server starting sh: /usr/local/var/postgres/server.log: No such file or directory
update 2: 更新2: rest
The touch was not successful so I did this instead: 觸摸不成功因此我這樣作了: postgresql
> mkdir /usr/local/var/postgres > vi /usr/local/var/postgres/server.log > ls /usr/local/var/postgres/ server.log
But when I try to start rails server, I still see this: 可是當我嘗試啓動rails服務器時,我仍然看到: code
Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?
update 3: 更新3:
> pg_ctl -D /usr/local/var/postgres status pg_ctl: no server running
update 4: 更新4:
I found that there WAS NO pg_hba.conf (only pg_hba.conf.sample) so I modified the sample and renamed it (to remover the .sample). 我發現沒有pg_hba.conf(只有pg_hba.conf.sample)因此我修改了樣本並將其重命名(以移除.sample)。 Here are the contents: 如下是內容:
# IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust
but I don't understand this: 但我不明白這個:
> pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start server starting > pg_ctl -D /usr/local/var/postgres status pg_ctl: no server running
also: 也:
sudo find / -name postgresql.conf find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory
update 5: 更新5:
sudo pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start Password: pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
update 6: 更新6:
this seems odd: 這看起來很奇怪:
> egrep 'listen|port' /usr/local/var/postgres/postgresql.conf egrep: /usr/local/var/postgres/postgresql.conf: No such file or directory
though, I did do this: 不過,我這樣作了:
>sudo find / -name "*postgresql.conf*" find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf.sample
so I did this: 因此我這樣作了:
egrep 'listen|port' /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample #listen_addresses = 'localhost' # what IP address(es) to listen on; #port = 5432 # (change requires restart) # supported by the operating system: # %r = remote host and port
so I tried this: 因此我試過這個:
> cp /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf > cp /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf
still getting the same "Is the server running?" 仍然是相同的「服務器正在運行嗎?」 message. 信息。