MySQL Datenbanken prüfen und reparieren
Nachfolgend befindet sich ein Script, das bei Ausführung die MySQL Datenbank überprüft und gegebenenfalls repariert:
(farbig markierte Stellen bitte anpassen)
#!/bin/bash
#====================================Head=======================================
#Autor: Tobias Zweifel
#Beschreibung: automatisches ueberpruefen der MySQL Datenbank
#Erstellt am: 28.05.2015
#Aenderungen: 28.05.2015
#====================================Head=======================================
#————————————-Start————————————-
DATEVAR=
date +20\%y\%m\%d_\%H\%M\%S
IGNORE=”hier zu ignorierende Datenbanken hinzufügen“
password=”deinrootpasswort“
DBS=”$(/usr/bin/mysql –user=root –password=deinrootpasswort -Bse ‘show databases’ | /bin/grep -Ev $IGNORE)”
NOW=$(date +”%Y-%m-%d”)
for DB in $DBS; do
mysqlcheck –user=root –password=deinrootpasswort $DB –analyze –check –auto-repair > /var/log/mysql/check/$DB-check-$DATEVAR.log
done
Hier werden alle Funktionen beschrieben: https://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html
By continuing to use the site, you agree to the use of cookies. more information
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.