Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

无法连接到服务器:连接被拒绝服务器是否在主机“127.0.0.1”上运行并在端口5432上接受TCP/IP连接?

查看psql是否在运行

ps -ef|grep postgres

ps -ef | grep postgres 查看某个进程

ps -ef 查看全部进程

如果没有运行的话,启动即可

pg_ctl start
Linux 系统可以直接切换到 postgres 用户来开启命令行工具:

#  sudo -i -u postgres
修改一个数据库。

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name RESET parameter
ALTER DATABASE name RENAME TO new_name
ALTER DATABASE name OWNER TO new_owner

更多推荐