Running PGAdmin after Silent installation, what is the login? - postgresql

I started an installation of Postgres in unatended mode with the commandline:
postgresql-9.5.2-1-windows-x64-x64.exe --unattendedmodeui minimal --mode unattended --superpassword "password" --servicename "postgreSQL"
--servicepassword "password" --serverport 5432
After the installation is finished i want to login to the database with pgadmin. i tried with "password" but i get the error:
fatal password authentication failed for user postgres
so what are my login data for the installed database?
Thanks a lot
Marcel

If you don't know the password you have to change the pg_hba.conf file that contains all the authentication information.
You can read about how it works here:
http://www.postgresql.org/docs/devel/static/auth-pg-hba-conf.html
I suggest you to create a backup of the original file first and to reboot the server after changes.

I was facing the same issue. It looked like there was a conflict with previous installations of Postgres.
I could login using the password specified by --superpassword after cleaning all Postgres-related folders in program files as well as in custom install locations.
A professional approach would be running your installer on a clean system or a VM.

Related

creating a postgresql database back end for a new Label Studio project

I am creating a local Label Studio server to host images to annotate in our office. I would like the database back end to be postgresql and not sqlite and be located in a particular directory, not the default and not the same as the 'data-dir'. I have got a test server working across the network with various machines annotating images on the server, but the backend was sqlite for this test.
Everything I've tried to get a postgresql backend db has failed for various reasons. Some commands result in a sqlite db (occasionally with the name 'postgresql') located in my required directory; others create postgres/pyscopg2 errors but I think they're up a garden path.
The host machine is running Ubuntu 20.04 LTS. And serves another postgresql db over the network using other APIs. Postgresql version running is 12.9.
I have created a conda environment and pip installed Label Studio as the documentation suggested.
Here's what I've tried:
Start the conda environment. Follow instructions to assign environment variables from https://labelstud.io/guide/storedata.html#PostgreSQL-database which at time of writing is:
DJANGO_DB=default
POSTGRE_NAME=postgres
POSTGRE_USER=postgres
POSTGRE_PASSWORD=
POSTGRE_PORT=5432
POSTGRE_HOST=db
Then a few variations on the start command (I didn't include the backslashes, just put here for readability/comparability):
label-studio start --init \
-db postgresql \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: db is where expected, but:
file newdb
gives "newdb: SQLite 3.x database, last written using SQLite version 3038002"
label-studio start --init \
--database /path/to/label-studio/databases/newdb \
-db postgresql \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: a db at specified path named 'postgresql' and still an sqlite db. This seems to mirror the mistake mentioned at: https://github.com/heartexlabs/label-studio/issues/1660
I have also tried the above two commands with the '--init' argument omitted with same results.
Then I tried adding something on the front of the command suggested at the same link above:
DJANGO_DB=default label-studio start \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
DJANGO_DB=default POSTGRE_PASSWORD= label-studio start \
--database /path/to/label-studio/databases/newdb \
--data-dir /path/to/label-studio/media_dirs/test_proj
result: psycopg2.OperationalError: fe_sendauth: no password supplied
Any help and resolution would be highly appreciated.
Also, I can't tag this with 'label-studio' because I'm not quite at the required reputation to create a new tag, so if anyone who can feels like doing so, pleaseandthankyou!
Your last option was closer than all the others. Have you tried to run LS using this:
DJANGO_DB=default POSTGRE_NAME=<postgres_name> POSTGRE_USER=<postgres_user> POSTGRE_PASSWORD=<password> POSTGRE_PORT=<db_port> POSTGRE_HOST=<db_host> label-studio
Sure, you have to run postgres service by yourself, configure it properly, create the DB <postgres_name>, the user <postgres_user> and set the password <password>, grant access rights to this user. Also don't forget to specify <db_host> (localhost?), <db_port> (5432?)

How can I run Postgres locally on two accounts

On my MacBook I have two user profiles. One for work and one for personal use. I develop on both and recently I've wanted to start a local Postgres server but I can't seem to do this. When I try to run pg_ctl -D /usr/local/var/postgres I get this error:
pg_ctl: could not open PID file "/usr/local/var/postgres/postmaster.pid": Permission denied
I also can't run it as a super user as it says pg_ctl: cannot be run as root
I think this might be because I installed Postgres on my work user profile and even though I can still access the CLI I can't run the Postgres server as I don't have the right permissions on my personal user profile.
Apologies in advance if this is a really obvious error, I am new to development 😅
If there is a PID file present, either the database is running, or you did not shut it down properly, and it crashed.
Anyway, your idea is doomed. Only the user who owns the database files can start the database server.
Perhaps you can use sudo:
sudo -u dbowner pg_ctl start -D /usr/local/var/postgres
But I guess that you misunderstand the principle of client-server software.
You should have the system start PostgreSQL as a service, running as the database owner. Then it is irrelevant as which operating system user you run the client software (unless you are using peer authentication in PostgreSQL).

psql: FATAL: role "root" does not exist when creating database from fabric explorer's sql file

I meet error psql: FATAL: role "root" does not exist when running ./createdb.sh from https://github.com/hyperledger/blockchain-explorer. I am trying to run the blockchain explorer on Centos.
I think the last version broke something, or makes it incompatible with some of the tooling around.
Try reverting to the prev docker images:
hyperledger/explorer-db:0.3.8
hyperledger/explorer:0.3.8
That did the trick for me.
Similar error for me "psql: FATAL: role "postgres" does not exist" when running the createdb.sh script. I am trying to install on ubuntu.
I fixed it by running the following command before :
/home/linuxbrew/.linuxbrew/Cellar/postgresql/11.4/bin$ createuser -s postgres
than run the createdb.sh script WITHOUT using sudo.
Hope this can help somebody.
You should specify the DB user while running the script.
Modify explorerconfig.json under blockchain-explorer/app to include the properties of the connection to DB like "host", "port", "database", "username" and "password".
Please refer to this readme from their github repo - https://github.com/hyperledger/blockchain-explorer/blob/master/README.md#Database-Setup

Configuration steps for Postgres db

I want to build and run following application https://github.com/sdeleuze/geospatial-messenger
I have little experience with backend and data bases so I need some guidance with following installation step:
Customize database configuration on application.yml.
application.yml
logging:
level:
org.springframework.web.servlet: INFO
spring:
datasource:
platform: "postgis"
driver-class-name: "org.postgis.DriverWrapper"
url: "jdbc:postgresql_postGIS://localhost/geospatial-messenger"
username: "postgres"
mvc:
async:
request-timeout: 1000000
Please outline steps that I should perform with my data base to configure it according to a file.
I have PostgreSQL 10 on Ubuntu 18.04
After installation of PostgreSQL10, please follow the below steps :
1. Login to root user, run this command su – postgres
2. Locate the pg_hba.conf file by running select Query: select current_setting('hba_file');
3. Modify the pg_hba.conf file
4. Example : vim /prod/pgsql_10/pg_hba.conf command.
5. Press insert key where you want to modify and save it using esc + :wq
Example: host all all 10.10.11.183/32 md5
trust – without password authentication
md5 – with password authentication
6. After modification, we should restart the postgres service using this command
systemctl restart postgresql-10.service
7. Also modify the postgresql.conf file as same as pg_hba.conf file.
locate postgresql.conf
vim /prod/pgsql_10/postgresql.conf
8. After modification, we should restart the postgres service using this command
systemctl restart postgresql-10.service
9. To login postgres, run this command psql -U esb(user) postgres(DB)
You already have the PostgreSQL installed, so you only need PostGIS for this to work. For Ubuntu, it is better if you use UbuntuGIS. You can add UbuntuGIS repository and install PostGIS from it. http://trac.osgeo.org/ubuntugis/wiki/QuickStartGuide.
Another way is to use PostgreSQL's repository http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS24UbuntuPGSQL10Apt

could not start pgAgent due to log on failure

I wanted to install pgAgent service on windows. Though it installs alright using the following command:
C:\Program Files (x86)\pgAdmin III\1.14>pgagent.exe INSTALL pgAgent -l2 -u postgres hostaddr=localhost port=5432 dbname=postgres user=postgres
the service does not start giving an error: Windows could not start pgAgent service on the local computer. Error 1069: The service did not start due to a logon failure.
The password is being provided using pgpass.conf file. The same password is being used by pgAdmin to logon to databases.
I have even tried by providing same password (as pgpass.conf) using -p option on the command line itself. It did not work either but error is different. On command line it says service could not be started. Service reported no error . However when I see logs in Control Panel/EventViewer following warning is shown:
Couldn't create the primary connection (attempt 10): fe_sendauth: no password supplied
and then an error:
Stopping pgAgent: Couldn't establish the primary connection with the database server.
If it could help, I downloaded pgAgent separately and placed pgAgent.exe in pgAdmin III/1.14 folder where libpq.dll also resides. I am using PostgreSQL 9.0, pgAdmin 1.14 and pgAgent 3.0.0
Can somebody please help me with this?
Go to pgAgent installation folder on windows and execute
C:\Program Files (x86)\pgAgent\bin>pgagent REMOVE pgAgent
This will remove the existing misconfigured windows service
then reinstall the service in the following way giving the password credentials properly. The first -u gives the postgres user created on windows and the second username in the connection string is the db username.
After doing the below start the service and check the Event Viewer if you still see the error.
C:\Program Files (x86)\pgAgent\bin>pgagent --help
Usage:
pgagent REMOVE <serviceName>
pgagent INSTALL <serviceName> [options] <connect-string>
pgagent DEBUG [options] <connect-string>
options:
-u <user or DOMAIN\user>
-p <password>
-d <displayname>
-t <poll time interval in seconds (default 10)>
-r <retry period after connection abort in seconds (>=10, default 30)>
-l <logging verbosity (ERROR=0, WARNING=1, DEBUG=2, default 0)>
C:\Program Files (x86)\pgAgent\bin>pgagent INSTALL pgAgent -u postgres -p admin
-l 2 hostaddr=127.0.0.1 port=5433 user=postgres dbname=first password=admin
ok guys, i am able to solve the issue, by reinstalling PostgreSQL and then installing pgAgent with StackBuilder.