<para>
<screen>
-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?
</screen>
This is the generic <quote>I couldn't find a server to talk
to</quote> failure. It looks like the above when TCP/IP
</para>
<para>
- 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:
<screen>
-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?
</screen>
+ If the server is indeed running, check that the client's idea of the
+ socket path (here <literal>/tmp</literal>) agrees with the server's
+ <xref linkend="guc-unix-socket-directories"/> setting.
</para>
<para>
- 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
<computeroutput>Connection refused</computeroutput> or
<computeroutput>No such file or directory</computeroutput>, as
illustrated. (It is important to realize that
linkend="client-authentication-problems"/>.) Other error messages
such as <computeroutput>Connection timed out</computeroutput> might
indicate more fundamental problems, like lack of network
- connectivity.
+ connectivity, or a firewall blocking the connection.
</para>
</sect2>
</sect1>
<para>
Another response could be this:
<screen>
-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?
</screen>
- This means that the server was not started, or it was not started
- where <command>createdb</command> expected it. Again, check the
+ This means that the server was not started, or it is not listening
+ where <command>createdb</command> expects to contact it. Again, check the
installation instructions or consult the administrator.
</para>
<para>
Another response could be this:
<screen>
-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
</screen>
where your own login name is mentioned. This will happen if the
administrator has not created a <productname>PostgreSQL</productname> 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:
<screen>
-createdb: database creation failed: ERROR: permission denied to create database
+createdb: error: database creation failed: ERROR: permission denied to create database
</screen>
Not every user has authorization to create new databases. If
<productname>PostgreSQL</productname> refuses to create databases