New to web development. Trying to connect and register new server for pgAdminIII. (using cloud 9 ide)..
I get this error when viewing in the browser..
_PG::CONNECTION BAD _
could not connect to server: Connection refused Is the server running on
"localhost" (::1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection
refused Is the server running on host "localhost"
(127.0.0.1) and accepting TCP/IP connections on port 5432
PS. trying to access via new user "ubuntu" SUPERUSER created..
How can I fix this?
PPS. On cloud 9's community forum, an employee says..
"Only ports 8080, 8081 and 8082 are open for workspaces so if you want to access the DB externally you'll need to run it on one of these ports. Make sure you can access it with curl from a local terminal and ensure it's listening on 0.0.0.0 not 127.0.0.1, as the latter only allows local connections."
Lastly, their ide comes with postgres installed, all I needed to do, was set it up..
How do I use the above info while trying to register the new server in order to use the gui?
Let me know if I need to include anything else.
Thanks.
You should enable postgresql service by performing sudo service postgresql start.
After enabling, you can access the console using sudo sudo -u postgres psql and CREATE ROLE ubuntu LOGIN REPLICATION CREATEDB CREATEROLE SUPERUSER; to allow Rails take advantage of your database.
Rails also complains about template read error after creating ubuntu role.
To fix the template error, read up on this.
You should get PostgreSQL server up and running in no time. Happy coding!
Edit:
You should only use localhost for local and system resources (i.e. psql, etc.) while 0.0.0.0 is for everything else like running Rails or Apache server.
Related
I'm trying to install postgreSQL(11) server on my local machine.I have downloaded PgAdmin 4(Mac) from the official website and installed it.
When I open the pgadmin the server is opening on random ports like 55957,55062 etc, not on 5432.
I have edited my "PostgreSQL.conf" and changed the listen address=* and port =5432 ,but I could not able to restart the service.
When I type "sudo service postgreSQL restart" it was showing "Sudo : Service command not found"
Also "Sudo command not found".
I don't have much experience in installing postgreSQL ,Can anyone please let me know what I'm doing wrong and let me know how I can add the server in postgres.
Note: I have opened pgadmin - select add new server - localhost as server name and User and DB as postgres.But when I put 5432 as port it was giving the common error "Whether TCP/ip accepting on 5432" and when I put the port where the pgadmin server is currently running (127.0.0.1:55097) it was getting timed out exception.
I'm trying to deploy my app on Heroku but I keep getting the same error I get locally when trying to start the server before starting the database:
psycopg2.OperationalError: 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?
Normally, I would just type sudo service postgresql start and that would solve it but it doesn't seem to work on Heroku bash.
Any suggestions?
You need to check if PostgreSQL addon is added to your project if not then you will need to add that by running
heroku addons:create heroku-postgresql:hobby-dev
For more option follow this link: https://www.heroku.com/postgres
I am new to PostgreSQL, and I want to use it on my personal laptop for personal projects. I use SQL Server and SQL Server Management Studio at work, coding-wise I'm ok but I need some help with setting up the localhost on my laptop.
So I downloaded PostgreSQL and installed it along with pgAdmin that came with the package.
During installation, it asked me to create a PostgreSQL superuser password, which I did.
Then I tried creating a new server using pgAdmin as follows:
General Tab:
Name: localhost
Server Group: Servers
Connect Now?: check
Connection Tab:
Host name/address: localhost Port: 5432
Maintenance database: postgres
Username: postgres
Password: [blank]
But when I click save I'm getting an error message:
Unable to connect to server: could not connect to server: Connection
refused (0x0000274D/10061) Is the server running on host
"localhost"(::1) and accepting TCP/IP connections on port 5432? could
not connect to server: Connection refused (0x0000274D/10061) Is the
server running on host "localhost"(127.0.0.1) and accepting TCP/IP
connections on port 5432?
Also tried replacing the password field with the Superuser password, getting the same error message.
Would greatly appreciate it if anyone offers any insights into this problem, I might just be a noob when it comes to server setups...
Thanks,
Mike
Update:
I believe there's a service I need to start as suggested by #Scott Moniz. I went into services.msc, tried to start the service postgresql-x64-10 - PostgreSQL Servier 10, and I got this error message:
"The postgresql-x64-10 - PostgreSQL Server 10 service on Local
Computer started and then stopped. Some services stop automatically if
they are not in use by other services or programs".
I then tried editing the property of the service, by changing the Log on as option to Local System Account and tried starting the service again, still got the same error message.
I'm using Windows 10 Home edition, it this helps to resolve the issues in anyway
Thanks,
Mike
Are you sure the database service is running and listening?
CLick Start>Run> type services.msc
Look for a postgresql service - if it does not say started right click it and click Start.
Alternatively you can restart your computer and the service should start if it is set to 'Automatic'
I have been trying for weeks to figure out what's the issue, but I cannot seem to fix this.
I am developing a web app, and I have deployed to production using Heroku. I'm using Heroku Postgres for my database, and I'd like to psql into that hosted database from my local machine to make changes to it. I have tried from both Mac OS X and Linux Mint.
However, no matter what I try, I keep getting the following error:
---> Connecting to HEROKU_POSTGRESQL_ORANGE_URL (DATABASE_URL)
psql: could not connect to server: Connection refused
Is the server running on host "ec2-***-**-***-**.compute-1.amazonaws.com" (***.**.***.**) and accepting
TCP/IP connections on port 5432?
I'm starting to think that I may have to SSH into the Amazon EC2 instance and change the Postgres configuration? Would that even be possible?
You can't connect directly to the EC2 instance where the Heroku Postgres instance is running; it is managed by Heroku and normal users aren't allowed to connect to it.
If your application is running fine in Heroku, and you're running heroku pg:psql to attempt to connect to the DB, then most likely there is some issue with your local network that is preventing you from connecting to the Postgres database, like a firewall blocking outbound connections. Heroku Postgres databases are open to the public without any restriction on IP ranges.
It could be a problem with the proxy or firewall of the internet connection you are using.
Try to connect your PC to your mobile phone tethering and then launch the command again, just to verify if the problem lies there.
I was getting this kind of error when my pg_hba.conf or AWS security groups have not been configured properly. There are plenty of docs about how to resolve this. For example, you can check this list link
You can directly connect to EC2 Heroku Postgress instance by adding this attributes to the end of your DB connection url:
jdbc:postgresql://<host>/<dbname>?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
I just installed PostgreSQL on Snow Leopard and can't connect to the database server via pgAdmin 3.
I'm on my local machine, however I keep getting this error:
Could not connect to server: connection refused. Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5423?
I'm a bit of a noob when it comes to Postgres, so I'm not really sure what the problem is.
I can, however, log in through the command line, via psql -U postgres, and start and stop the server successfully.
Any help would be much appreciated.
The error message pointed out that you tried to connect to server on port 5423. However, postgres server listens on 5432 by default.
From your above comment (SHOW port; gives me "5432"), I think you need to change the port to 5432!
UPDATE: Tuan Dang spotted it. I'll leave this answer in place in case it helps someone else for whom the issue isn't quite the same.
Since you can connect via the command line, run:
SHOW port;
from psql. You'll probably see that the port is not 5432. You need to connect to the port PostgreSQL is actually running on from your application.
It's also possible that it just isn't listening on TCP/IP. Run:
SHOW listen_addresses;
to see what it's listening for.
The reason you can connect via the command line is likely to be because the command line psql you're using is connecting over a unix socket (since you didn't specify a host) and your app is connecting via tcp/ip.