-psql: could not connect to server: Connection refused
- Is the server running on host "server.joe.com" and accepting
- TCP/IP connections on port 5432?
+psql: error: connection to server at "server.joe.com" (123.123.123.123), port 5432 failed: Connection refused
+ Is the server running on that host and accepting TCP/IP connections?
This is the generic I couldn't find a server to talk
to failure. It looks like the above when TCP/IP
- Alternatively, you'll get this when attempting Unix-domain socket
+ Alternatively, you might get this when attempting Unix-domain socket
communication to a local server:
-psql: could not connect to server: No such file or directory
- Is the server running locally and accepting
- connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
+psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
+ Is the server running locally and accepting connections on that socket?
+ If the server is indeed running, check that the client's idea of the
+ socket path (here /tmp) agrees with the server's
+ setting.
- The last line is useful in verifying that the client is trying to
+ A connection failure message always shows the server address or socket
+ path name, which is useful in verifying that the client is trying to
connect to the right place. If there is in fact no server
- running there, the kernel error message will typically be either
+ listening there, the kernel error message will typically be either
Connection refused or
No such file or directory, as
illustrated. (It is important to realize that
linkend="client-authentication-problems"/>.) Other error messages
such as Connection timed out might
indicate more fundamental problems, like lack of network
- connectivity.
+ connectivity, or a firewall blocking the connection.
Another response could be this:
-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 "/tmp/.s.PGSQL.5432"?
+createdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
+ Is the server running locally and accepting connections on that socket?
- This means that the server was not started, or it was not started
- where createdb expected it. Again, check the
+ This means that the server was not started, or it is not listening
+ where createdb expects to contact it. Again, check the
installation instructions or consult the administrator.
Another response could be this:
-createdb: could not connect to database postgres: FATAL: role "joe" does not exist
+createdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: role "joe" does not exist
where your own login name is mentioned. This will happen if the
administrator has not created a
PostgreSQL user account
If you have a user account but it does not have the privileges required to
create a database, you will see the following:
-createdb: database creation failed: ERROR: permission denied to create database
+createdb: error: database creation failed: ERROR: permission denied to create database
Not every user has authorization to create new databases. If
PostgreSQL refuses to create databases