I have successfully installed Postgres on Ubuntu 20.04 by running the following commands:
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev
which was successful. I then run the command:
$ sudo service postgresql start
which was also successful.
However, the command
$ sudo -u postgres createdb $USER
failed. The error message was as follows:
createuser: error: could not connect to database template1: 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"?
Please help me out.
Related
I'm trying to start a postgreSQL server in Debian 10 in order to access this database: https://catalogofraneitalia.wordpress.com/database/.
I have never used postgreSQL before and I have tried to follow the instructions I found on the internet. This is what I have run up to now:
sudo apt -y install gnupg2
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-11
sudo apt install postgis postgresql-11-postgis-3
I checked that postgreSQL is active, enabled and accepting connections
sudo su - postgres, psql and create user username with superuser password 'password' with the username and password chosen
sudo apt install pgadmin3 pgadmin3-data
I opened pgadmin and I cliked on Add server, inserting the username and password previously created and I received the message Peer authentication failed for user "username"
the correct steps to install pg are in the official site: https://www.postgresql.org/download/
Follow the steps on screen, once initialized you can open the port (listen_address and pg_hba.conf), restart the service, and done... you can connect from other machine.
Other thing, pgadmin3 is deprecated, try using pgadmin4.
createuser: 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 "/var/run/postgresql/.s.PGSQL.5432"?
I am trying to install dspace 6.3 on ubuntu server 18.04 but after installing postgresql when I run the command createuser -U postgres -d -A -P dspace I am getting the above error help please
Did you start the server? Try sudo service postgresql restart or sudo systemctl restart postgresql
I've tried to install Postgres for the past few days on Ubuntu 14.04. I have followed this set of commands:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge postgresql
sudo apt-get -f install
sudo apt-get install postgresql
With no such luck... The error message I get is as follows:
postgres#CouchVictory:~$ psql
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.5432"?
I've also tried the suggestion here and I've made sure that my shell is a login shell. Any suggestions?
I'm trying to install a postgresql database on my VPS server by using this guide.
In there it says
sudo apt-get install postgresql postgresql-contrib libpq-dev
And then
sudo su - postgres
createuser --pwprompt
exit
When I run createuser --pwprompt it asks me to create a password, once I fill it in I get the following error:
createuser: 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 "/var/run/postgresql/.s.PGSQL.5432"?
If I do psql --version I get psql (PostgreSQL) 9.4beta3
And which psql outputs /usr/bin/psql
Any idea on how to fix this problem?
Update
Running pg_ctl gives another error
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
The program 'pg_ctl' is currently not installed. To run 'pg_ctl' please ask your administrator to install the package 'postgres-xc'
Althgough reading up on postgres-xc shows quite a lot of other problems.
Under the postgres user, I tried the psql command and I'm getting this error:
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.5432"
But when I run /usr/local/pgsql/bin/psql, it is working.
Is there anything wrong with my configuration?
the above issue seems related to PostgreSQL default port no,
Change the port no in postgresql.conf file and restart the DB server. if u have changed the port while installing.
(OR)
instead of psql type full command like
"psql -p 5432 -h localhost"
You could include the database user too:
psql -U postgres -p 5432 -h localhost
Did you reinstall the postgresql-9.6.3 ?
You need to uninstall postgresql completely
sudo apt-get --purge autoremove postgresql*
sudo apt install postgresql-9.6