【问题标题】:So I installed postgresql and localhost port conflicting with ruby app?所以我安装了与 ruby​​ 应用程序冲突的 postgresql 和 localhost 端口?
【发布时间】:2016-08-18 04:26:27
【问题描述】:

我安装了 postgresql。我在 pgadmin 上将 localhost 端口设置为 3000。然后它开始抛出这个错误,因为我的 ruby​​ 应用程序的 localhost 端口也在端口 3000。 地址已在使用中 - bind(2) 用于“localhost”端口 3000 (Errno::EADDRINUSE

我尝试卸载它,但仍然出现错误。我试图删除 pgadmin。我试图设置一个环境变量export PGPORT=5432。毕竟,错误仍然出现。我只想摆脱 postgres 并重新安装所有东西,看看出了什么问题。我完全糊涂了。我对 ruby​​ 和 postgres 很陌生。我通常使用 node mongodb 等。

问题: 摆脱 postgresql 并重新安装它的最佳方法是什么? 关于如何编辑端口的任何其他想法? postgresql如何删除数据库?

我知道这听起来像我到处都是,因为我现在就在。我只想重新开始。所以请大家帮忙。

【问题讨论】:

  • 你是在 MAC 还是 WIN 上?
  • 注意:Rails 使用 3000,而 PostgreSQL 默认使用 5432。除非您有特定的授权,否则没有真正的理由更改这些端口。

标签: ruby-on-rails ruby postgresql


【解决方案1】:

在 Mac OSX 上安装和使用 PG/Mongo/MySql 的最佳方式是 Brew

如果未安装 brew,请通过复制/粘贴到终端进行安装。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 Postgresql

brew install postgresql

使用 DB(运行/重启/停止)

brew services list
brew services start postgres
brew services stop postgres

【讨论】:

    【解决方案2】:

    你也可以使用不同的端口。

    rails s -p 81
    

    如果你想总是从不同的端口开始..创建Rakefile并添加一个任务..

    task :server81 do
      `bundle exec rails s -p 8081`
    end
    

    rake server81可以直接使用

    【讨论】:

      猜你喜欢
      • 2016-03-27
      • 1970-01-01
      • 2016-06-23
      • 1970-01-01
      • 1970-01-01
      • 2017-09-20
      • 1970-01-01
      • 1970-01-01
      • 2020-11-06
      相关资源
      最近更新 更多