Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PosgreSQL Anmeldung PW über Argumente

Empfohlene Antworten

Veröffentlicht

Moin Moin Leute,

Ich wollt wissen ob es in Windows die Möglichkeit gibt bei einer Anmeldung

an eine PostgreSQL DB das passwort per Argumente/Parameter einzugeben.

In der Docu steht nix dazu.

Da PostgreSQL beim anmelden über Konsole in einer neuen zeile das

Passwort verlang. kann ich diesen automatismus abschalten oder mit .Net irgendwie umgehen??

MfG

CTom

Nein eben nicht ^^

Im Bin-Verzeichnis des ProstgreSQL sind die exe'n:

pg_dumpall.exe

pg_dump.exe

pg_restore.exe

Die will ich verwenden zum erstellen eines Backups und wieder einspielen.

Ich geb mal ein Beispiel:

pg_dump -U backupUser -f C:\backup.backup meineTestDB

Passwort für Benutzer backupUser: ******

Dieser Befehl macht folgendes der User "backupUser" für einen Dump auf die DB "meineTestDB" aus und speichert das unter "C:\backup.backup".

Daraunter erscheint ein Passwortfeld, was ich gerne umgehen will bzw automatisiert eingeben will über C++ oder C# wenn es nicht über Parameter geht.

Hoffe konnte etwas Klarheit schaffen.

MfG

CTom

Hi,

danke darauf bin ich schon gekommen was es mir ermöglicht, den pg_dump auszuführen. Da dieser aber ein SQL script erzeugt, kann ich das nicht mit pg_restore einlesen.

Das bedeutet ich muss über psql.exe mich anmelden und als Script ausführen, das pg_restore das nicht gebacken bekommt (Fehlermeldung: Kein Archiv.... bzw. nicht das richtige Format).

psql verlangt aber ZWINGEND das passwort per Hand einzugeben, was mist ist.

Da dieser Backup/Restore automatismus auf einem Webserver als Service ausgeführt werden soll und nicht jeden tag ein User vorm Webserver sitzt und das PW eingibt.

Wie gesagt:


set PGPASSWORD=DEINPASSWORD

Funktioniert um das Backup zu erstellen (Passworteingabe umgehen) aber nicht um dieses einzuspielen.

MfG

CTom

Super,

ich werde es heute gleich versuchen.

Danke schonmal für alle Antworten.

MfG

CTom

Oder einen User ohne Passwort anlegen. Der Standarduser postgres hat auch kein pw.

Ansonsten habe ich in der pg_dump Doku nur folgende Zeile gefunden:

--no-password

Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.

Bearbeitet von Sassy

The file .pgpass in a user's home directory or the file referenced by PGPASSFILE can contain passwords to be used if the connection requires a password (and no password has been specified otherwise). On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile).

This file should contain lines of the following format:

hostname:port:database:username:password

PostgreSQL: Documentation: Manuals: PostgreSQL 8.1: The Password File

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.