postgresql-9.2 – PostgresQL:如何启动数据库服务器并创建数据
发布时间:2020-12-13 16:01:16 所属栏目:百科 来源:网络整理
导读:当我尝试运行服务器时: postgres@ubuntu:~$/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/dataLOG: could not bind IPv4 socket: Address already in useHINT: Is another postmaster already running on port 5432? If not,wait a few seconds and r
当我尝试运行服务器时:
postgres@ubuntu:~$/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data LOG: could not bind IPv4 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not,wait a few seconds and retry. WARNING: could not create listen socket for "localhost" FATAL: could not create any TCP/IP sockets postgres@ubuntu:~$ 然后我将用户改为自己: postgres@ubuntu:~$su - michael michael@ubuntu:~$ sudo netstat -tulpn | grep 5432 tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 959/postgres 好吧,postgres似乎正在听端口,这似乎是问题所在. 让我们将pack更改为postgres并尝试终止此过程: postgres@ubuntu:~$kill `cat /usr/local/pgsql/data/postmaster.pid` 反应是: cat: /usr/local/pgsql/data/postmaster.pid: No such file or directory kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] 你能推荐我怎么办吗? 解决方法
首先,运行Postgres pid:
ps -ef | grep postmaster | awk '{print $2}' 然后杀了它 kill <the_pid_you_just_got> 但除非你试图用Postgres(多个实例……)做一些非常特殊的事情,你应该使用sudo /etc/init.d/postgresql stop(或sudo /etc/init.d/postgres stop)来停止它并启动它使用sudo /etc/init.d/postgresql start Postgres作为服务运行,因此它有一个服务控制文件/脚本,负责正确启动和停止它.这些控制文件曾经位于/etc/init.d中,但我必须承认,这些日子已经变得有点乱,服务管理系统越来越多(init,upstart,systemd …) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |