[ubuntu-za] Database Problems - Installing PostgreSQL

Matthew French matthew at gillyweed.co.za
Mon Jan 25 17:06:32 GMT 2010


On 25 Jan 2010, at 11:40 AM, Ian Whitfield wrote:
> psql: could not connect to server: no such file or directory
> 
> The documentation offers another way to connect.The command is....
> 
> sudo -u postgres createuser --superuser $USER
> 
> Here I get the error.....
> 
> createuser: could not connect to database postgres: could not connect to 
> server: no such file or directory.

Very odd, although the error message seems quite explicit. It seems postgres is not starting?!?

Check that postgres is running:

$ ps -ef | grep postgres
postgres  3788     1  0 Jan22 ?        00:00:11 /usr/lib/postgresql/8.3/bin/postgres -D /data/postgresql/8.3/main -c config_file=/etc/postgresql/8.3/main/postgresql.conf
postgres  3799  3788  0 Jan22 ?        00:00:23 postgres: writer process                                                                                                
postgres  3800  3788  0 Jan22 ?        00:00:21 postgres: wal writer process                                                                                            
postgres  3801  3788  0 Jan22 ?        00:00:11 postgres: autovacuum launcher process                                                                                   
postgres  3802  3788  0 Jan22 ?        00:00:12 postgres: stats collector process                                                                                        

You could also try looking at the postgres log:
# less /var/log/postgresql/postgresql-8.3-main.log

You might need to change the 8.3 to your version number...

If you are connecting from the same machine then the psql command won't use tcp/ip, so no point checking network settings.

Did you change any config files? Postgres normally works straight out the box on Ubuntu. If you modified the configuration then there might be a syntax error or something silly preventing the the database from starting up?

HTH,

- Matthew




More information about the ubuntu-za mailing list