Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Do 21.10.21 10:50 
Moin Forum,

ich möchte eine mysql Datenbank per mysqldump sichern. Dummerweise enthält das Passwort ein Leerzeichen, als Beispiel: "abc def".

ausblenden Quelltext
1:
"C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqldump" -hlocalhost -uroot -pabc def "NameMeinerDatenbank" > c:\DB_Backups\Datenbank_backup.sql					


Das klappt natürlich so nicht. Wie kann ich das Passwort korrekt übergeben?

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
erfahrener Neuling
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 233
Erhaltene Danke: 19

Win 7, Win 10
C#, ASP-MVC (VS 2017 Community), MS SQL, Firebird SQL
BeitragVerfasst: Do 21.10.21 11:01 
Moin,
konnts nicht testen, aber nach kurzer Recherche das hier gefunden Escaping a password using mysqldump console
Probier mal, das Passwort einfach in Hochkommas zu setzen, also -p'abc def'

Moderiert von user profile iconTh69: Code-Tags hinzugefügt
Moderiert von user profile iconTh69: URL-Titel hinzugefügt
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Do 21.10.21 11:10 
ausblenden Delphi-Quelltext
1:
"C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqldump" -hlocalhost -uroot -p' + QuotedStr(PW_ADMIN) + ' "' + DB_NAME + '" > ' + Zieldateiname					


Das Passwort, so mit QuotedStr übergeben, erzeugt in der Befehlszeile das Passwort so:
ausblenden Quelltext
1:
-p''abc def''					

und damit funktioniert es leider nicht.

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 21.10.21 11:49 
In dem Link steht doch, daß unter Windows die normalen (doppelten) Hochkommata benutzt werden müssen: -p"abc def"

Für diesen Beitrag haben gedankt: erfahrener Neuling
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Do 21.10.21 12:07 
Ich Stoffel!
Danke das wars :-)

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...