When I issued the command:
psql -h localhost -U ruanpc
The console fails to connect to localhost postgres db and display:
psql: symbol lookup error: psql: undefined symbol: PQsetErrorContextVisibility
My postgres and psql versions are:
ruanpc#slave-40:~$ postgres --version
postgres (PostgreSQL) 11devel
ruanpc#slave-40:~$ psql --version
psql (PostgreSQL) 11devel
Any one knows how to solve it?
Your psql loads a libpq with version 9.5 or older. Make sure to use the same version of libpq as the psql version.
Oh, I forget to set the LD_LIBRARY_PATH to point to Postgres shared library!
Easy fix for me!
Related
I tried to restore a database from the command line using
pg_restore --host localhost --port 5434 __username "postgres" --dbname "database_name" -- verbose ""file_path"
But I keep getting the same message
pg_restore archiver unsupported version (1.13) in file header
BTW: I'm using Postgres 9.6
Is there another way to solve it without upgrading PostgreSQL?
I've tried to install postgres 13.1 on my Mac using homebrew. (Also tried versions 11 & 12 which at one time were installed on this Mac, but encountering same error with those versions now). Am using notes I took from previous installs & of course google/stackoverflow. Tried many things/many times, but always, if I run psql, createuser, createdb (any postgres command), it responds with:
FATAL: role "postgres" does not exist
Also tried just creating a postgres user on my Mac to run install from that account; no luck.
Also tried postgresql install from the enterprisedb.com site. That worked, but seems klunky & seems to rely on .sh scripts. Interestingly, got the 'role postgres does not exist' error after the edb install too, but noticed if I just entered 'postgres' twice on the command line it worked. Example:
/Library/PostgreSQL/13/bin/psql -h localhost -p 5432 -U postgres postgres
This trick doesn't work tho with the brew install.
Understand I need to create the postgres role, but I can't find a command to do this that doesn't complain that the role doesn't already exist.
Any help would be so so appreciated!
Most sites documenting postgres install with homebrew said to use commands like:
psql postgres
or
createuser postgres
Those didn't work for me, but this did:
psql -d postgres -U <myUserName>
Attaching a screenshot to try to summarize the install experience & what worked:
screenshot
Can you try:
/Library/PostgreSQL/13/bin/psql
and then:
CREATE USER postgres SUPERUSER;
?
This document solved it for me: https://enrq.me/dev/2021/01/13/fix-role-postgres-does-not-exist/
The gist: run createuser -s postgres -U <os-username>
Hey so after I ran into somes issues I decided to uninstall Postgres and re-install it (re install a newer version btw).
I'm trying to access postgres to create a new db for my Rails app so I run su postgresor su _postgres then I am asked a password but nothing that I enter works.
So I tried sudo -u postgres psql and got
sudo: unknown user: postgres
sudo: unable to initialize policy plugin
I tried also to disable SIP (see: here)
but it didn't work either. same results.
I don't know what to do. Any idea ? I am using Mac OS High Sierra 10.13.6.
Thanks to #gordon Davidson and #wildplasser 's help, I found the solution:
sudo -u myusername psql postgres
I had this same challenge when trying to access a PostgreSQL database.
When I run the command below:
sudo -u postgres psql
I get the error below:
sudo: unknown user: postgres
sudo: unable to initialize policy plugin
The issue was that I did not have the PostgreSQL database server installed on the server. The server only had a MySQL database server set up on it.
That's all.
I hope this helps
From your EC2 node issue the following command to test if database is reachable.
/opt/gitlab/embedded/bin/psql -U YourExistingUsername -d template1 -h AWS-RDS-POSTGRES-ENDPOINT
I have a sevrer that has an instance of postgres 9.4 I am using.
I installed another version of postgres (9.6), but have come across an issue.
To init the new db, I ran
sudo -u postgres /usr/pgsql-9.6/bin/initdb -D /var/lib/pgsql/9.6/data/
But when I check the sql, I get the following.
sudo -u postgres /usr/pgsql-9.6/bin/psql
psql (9.6.9, server 9.4.18)
Type "help" for help.
postgres=# SHOW config_file;
config_file
-----------------------------------------
/var/lib/pgsql/9.4/data/postgresql.conf
I can see it is using my 9.4, but I am unsure how to correct this issue, and have not managed to find any resources that indicate how to do so.
Any help would be appreciated.
The 9.4 postgres use the default port and I guess you set another one for postgres 9.6.
Connect to it with psql -P xxxx where xxxx is the 9.6 port number.
I have PostgreSql 9.3 version installed in my ubuntu 14.04 machine. I just installed the 9.4 version as well and the port it is on is 5433(by default). When i give the command psql --version, it gives me the following:
psql (PostgreSQL) 9.4.1
So far so good! Now i am trying to change my password for my postgresql 9.4 and i gave the following command:
>>sudo -u postgres -p 5433 psql
psql (9.4.1, server 9.3.6)
Type "help" for help.
postgres=# alter user postgres with password 'password';
ALTER ROLE
postgres=# \q
Now i tried connecting it on pgadmin3 but it would give me the password authentication failure. Am i doing it right?
sudo -u postgres psql -p 5433
Your -p 5433 as you write it is treated as an option for sudo, not for psql. And you've connected to Postgres 9.3 on standard port.
Try using:
>>sudo -u postgres -p 5433 psql
psql (9.4.1, server 9.3.6)
Type "help" for help.
postgres=# \password
Enter new password:
Enter it again:
postgres=#