Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 508 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PG::ConnectionBad - could not connect to server: Connection refused

#11
This is what really helped me.

$ cd /usr/local/var/postgres/
$ rm postmaster.pid
Reference:

[To see links please register here]

Reply

#12
As suggested above, I just opened up the **Postgres App** on my Mac, clicked Open `Psql`, closed the `psql` window, restarted my **rails server** in my terminal, and it was working again, no more error.

Trust the elephant:

[To see links please register here]

Reply

#13
I have managed to solve the problem by following the Chris Slade's answer, but to restart the server, I had to use the following commands:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

that I found [here][1] (pjammer's answer down at the bottom)


[1]:

[To see links please register here]

Reply

#14
put `host: localhost` in `database.yml` file and run this command:

rake db:create db:migrate
Reply

#15
I just run this command `sudo service postgresql restart`
and everything worked again.
Reply

#16
1. Uninstall pg:

<pre><code>gem uninstall pg</code></pre>

2. Uninstall postgres:

<pre><code>brew uninstall postgres</code></pre>

3. Nuke the postgres folder which might be lingering with a bunch of stale stuff it in:

<pre><code>rm -rf /usr/local/var/postgres</code></pre>

4. Reboot (maybe unnecessary)

5. Reinstall pg:

<pre><code>brew install postgres</code></pre>

6. My comment in Chris Slade's answer starts pg the hard way, now I use brew services which has simplified my life in so many ways:

<pre><code>brew install services</code></pre>

7. And start pg with it:

<pre><code>brew services start postgresql</code></pre>

8. Reinstall the gem:

<pre><code>gem install pg</code></pre>

And bobsyouruncle.
Reply

#17
To fix these type of issues with **Postgres** and to work with **Postgres** on `Mac OSX`, this is probably the ***BEST*** and the ***EASIEST*** solution that I have found so far:

[To see links please register here]


Just download, install and be happy :)
Reply

#18
Do you have postgresql installed within your system? If not, then watch [Install postgresql](

[To see links please register here]

). After you successfully integrate **postgresql** into your system you can type something like that in your system terminal:

which psql
#=> /usr/bin/psql

After that you need to create a user and database in postgresql like this:

sudo su - postgres
psql

Then you can see the following within your terminal

postgres=#

Type there:

CREATE USER yourname WITH PASSWORD 'passwordhere';
CREATE DATABASE metals-directory_production WITH OWNER yourname;
GRANT ALL PRIVILEGES ON DATABASE metals-directory_production TO yourname;

After you do this, then you need to correct your `database.yml`. Probably you need something like that:

development:
adapter: postgresql
encoding: unicode
database: metals-directory_development
pool: 5
username: yourname
password: passwordhere ### password you have specified within psql
host: localhost
port: 5432 ### you can configure it in file postgresql.conf

Also if you have problems with postgresql it is good idea to check [pg_hba.conf](

[To see links please register here]

)
Reply

#19
check the file **postgresql.conf** (on `ubuntu` is in **/etc/postgresql/X.X/main/postgresql.conf** ) and look for the line that says:

listen_addresses="localhost"

try change it to:

listen_addresses="*"

it would be accepting every IP's, next check the line that says:

port=5432

and check if is the same port of your database.yml, by default on my postgresql-9.2 use **5433** instead **5432**, don't forget to **restart** the postgres server,

*Good Luck!*
Reply

#20
Mac users with the Postgres app may want to open the application (spotlight search Postgres or find the elephant icon in your menu bar). Therein you may see a red X with the message: "Stale postmaster.pid file". Unfortunately a spotlight search won't show the location of this file. Click "Server Settings...", and in the dialog box that opens, click the "Show" button to open the Data Directory. Navigate one folder in (for me it was "var-10"), and delete the `postmaster.pid` file.

Go back to the Postgres app and click the Start button. That red X should turn into a green check mark with the message "Running". Now you should be able to successfully run Rails commands like `rails server` in the terminal.

[![Postgres App Server Settings - Show Data Directory][1]][1]


[1]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through