Skip to content

Instantly share code, notes, and snippets.

@Bios-Marcel
Created April 11, 2018 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bios-Marcel/24372d1b4c72dcee147e5243f514d794 to your computer and use it in GitHub Desktop.
Save Bios-Marcel/24372d1b4c72dcee147e5243f514d794 to your computer and use it in GitHub Desktop.
Waiting for a MySQL Server to be up via windows batch
echo Warte bis der MySQL Server hochgefahren ist...
:: Es wird solange versuche eine Verbindung zum MySQL Server aufzubauen, bis es funktioniert.
:: Der Parameter "-e" bedeutet "execute" und führt das nachfolgende Statement aus
:: Als nachfolgendes Statement nutzen wir hier ein leeres Statement, da wir keinerlei Query ausführen wollen.
:: Ist die Testabfrage nicht erfolgreich, so wird die variable %ERRORLEVEL% auf 1 gesetzt und dass nachfolgende "echo" und das "goto" werden getriggert
:offline
PATHTOMYSQL\mysql.exe --host=HOST --port=PORT -u User -pPassword -e ";" || (echo Konnte keine Verbindung aufbauen, versuche erneut & goto :offline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment