当前位置: 首页 > 知识库问答 >
问题:

Postgres数据库本地安装/运行

麻阳
2023-03-14
$ createdb geo
createdb: could not connect to database postgres: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

$ postgres -D /usr/local/var/postgres
FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 221) running in data directory "/usr/local/var/postgres"?

$ pg_ctl -D /usr/local/var/postgres -l logfile start
pg_ctl: another server might be running; trying to start server anyway
server starting
$ kill -9 221
$ pg_ctl -D /usr/local/var/postgres stop
waiting for server to shut down.... done
server stopped

$ pg_ctl -D /usr/local/var/postgres start
pg_ctl: another server might be running; trying to start server anyway
server starting
FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 1436) running in data directory "/usr/local/var/postgres"?

另一个尝试:

$ cd /usr/local/var/postgres
$ mv postmaster.pid postmaster.backup
$ pg_ctl -D /usr/local/var/postgres start
server starting

$ LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
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.
LOG:  could not bind IPv6 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

有没有人用美洲狮成功做到这一点?如果是的话,我错过了什么?感谢您对此问题的帮助!

共有1个答案

韩恺
2023-03-14

消息

createdb:无法连接到数据库postgres:无法连接到服务器:没有这样的文件或目录是本地运行并接受Unix域套接字“/var/pgsql_socket/.s.pgsql.5432”上的连接的服务器吗?

指示PostgreSQL服务器不使用/var/pgsql_socket作为其Unix域套接字目录,该目录是服务器和客户端之间的会合点。这是很常见的,因为只有Apple随OSX服务器提供的PostgreSQL才使用该路径。顺便提一下,这就是为什么Apple提供的createdb命令尝试连接到Apple配置的服务器。

如果使用brew,我建议应用superuser.com上的答案:我应该如何在我的Mac上设置PATH变量,以便找到Hombrew安装的工具?

您提到的postgres+postgis教程的作者很久以前就改变了它的path并且忘记在他的文章中提到它了。

完成后,createdb命令应该返回/usr/local/bin/psql这是自制版本,而不是最初的/usr/bin/psql这是Apple版本。

 类似资料:
  • 我试图在我的Postgres 9.1中安装plpython,但它使服务器崩溃: 我已经安装了python 2.6.8,并且在系统中正确声明了处理程序: 并且处理程序安装在$libdir中: 任何有关这方面的线索都将受到重视 编辑 我尝试创建扩展plpythonu、plpython2u和plpython3u,它们都会使服务器崩溃。 读了一些文档后,我发现\dx命令列出了已安装的扩展: 所以我想唯一安

  • 我有一个django项目与PostgreS数据库。我需要在docker容器中使用我的本地数据库。如何与docker容器共享机器的localhost?My Docker-compose.yml: Django Settings.py: 我添加了 现在我有一个错误: 谁能帮我?求求你!

  • 本文向大家介绍centOS7安装MySQL数据库,包括了centOS7安装MySQL数据库的使用技巧和注意事项,需要的朋友参考一下 1、先检测系统是否自带原有版本mysql安装包,如果有要先卸载删除,不然不能成功安装和启动; # rpm -qa|grep mysql      查看有哪些安装包,如果直接跳过,说明没有安装包,记忆可以直接进入第2、3 # yum remove mysql mysql

  • 这节课我们将来配置MySQL数据库,启动运行在另外一个容器中,然后把它link到users-service容器中...... 增加Flask-SQLAlchemy和PyMySQL到requirementx.txt文件中: Flask-SQLAlchemy==2.3.2 PyMySQL==0.8.0 当然要记得安装这些依赖包: (tdd3)$ pip install -r requirements

  • MySQL是最著名的开源数据库,现在正在开发的5.0版将具有大量的新特性,如存储过程和事务处理等。MySQL的性能正一步步地迫近Oracle、DB2等商业大型数据库,给这些产品造成了很大的压力。 在Debian中安装MySQL服务器是很方便的,使用apt-get命令即可完成。 debian:~# apt-get install mysql-server mysql-client mysql-s

  • 安装Mysql服务器 官方文档:安装和升级MySQL 这里给出在windows和linux中安装mysql服务器的方法,同时补充一种在docker中安装mysql容器的方法。 TIPS: 因为mysql在centos7中已经开始收费,因此本文在linux中实际安装的是mariadb。 windows 在windows下使用mysql服务器有两种方式,一种是使用mysql提供的MSI Install