I just upgraded my account for Postgres support but can't seem to figure out how to make it work correctly. I'm following a tutorial with the following steps:
First you need to start the Postgres server. Remember this command - any time you get connection errors talking about port 5432, run this again:
$ sudo service postgresql start
The next step is to create a user which matches your default user. To do this you can use the createuser command.
$ sudo sudo -u postgres createuser ubuntu --interactive
Each user needs a database associated with it, so create that now:
$ createdb ubuntu
If all has gone well, you can simply type the psql command and get directly into the postgres command prompt.
$ psql psql (9.3.7) Type "help" for help. ubuntu=#
There are many problems with this, such as not being able to "sudo" commands. However, even when using the Postgres console, I still can't connect to any database, either the default one or the new "ubuntu" DB, as I receive the following error:
$ psql -p 10494 --username=ubuntu psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.10494"?
If I run my Python code, I get a similar error:
psycopg2.OperationalError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
How can I create/connect to a Postgres DB outside of the Postgres console?