Updated recovery instructions to remove triggers before dropping database
This commit is contained in:
parent
5776014ff9
commit
e7506ac787
|
@ -85,6 +85,7 @@ sudo mysqldump ${NEWDB} > /root/${NEWDB}-$(date +%Y%m%d).sql
|
||||||
|
|
||||||
And now the actual recovery (Need to be in the same session! Do not enter this in another SSH window / terminal):
|
And now the actual recovery (Need to be in the same session! Do not enter this in another SSH window / terminal):
|
||||||
```
|
```
|
||||||
|
echo "select concat('drop trigger ', trigger_name, ';') from information_schema.triggers where trigger_schema = '${NEWDB}'" | sudo mysql --disable-column-names | sudo mysql ${NEWDB}
|
||||||
sudo mysql -e 'DROP DATABASE IF EXISTS `'${NEWDB}'`'
|
sudo mysql -e 'DROP DATABASE IF EXISTS `'${NEWDB}'`'
|
||||||
sudo mysql -e 'CREATE DATABASE `'${NEWDB}'`'
|
sudo mysql -e 'CREATE DATABASE `'${NEWDB}'`'
|
||||||
for table in ${BACKUPDIR}/${DB}/*; do gunzip -c $table | sudo mysql ${NEWDB}; done
|
for table in ${BACKUPDIR}/${DB}/*; do gunzip -c $table | sudo mysql ${NEWDB}; done
|
||||||
|
@ -106,6 +107,7 @@ sudo mysqldump -u admin -p$(cat /etc/psa/.psa.shadow) ${NEWDB} > /root/${NEWDB}-
|
||||||
|
|
||||||
And now the actual recovery (Need to be in the same session! Do not enter this in another SSH window / terminal):
|
And now the actual recovery (Need to be in the same session! Do not enter this in another SSH window / terminal):
|
||||||
```
|
```
|
||||||
|
echo "select concat('drop trigger ', trigger_name, ';') from information_schema.triggers where trigger_schema = '${NEWDB}'" | sudo mysql --disable-column-names -u admin -p$(cat /etc/psa/.psa.shadow) | sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) ${NEWDB}
|
||||||
sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) -e 'DROP DATABASE IF EXISTS `'${NEWDB}'`'
|
sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) -e 'DROP DATABASE IF EXISTS `'${NEWDB}'`'
|
||||||
sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) -e 'CREATE DATABASE `'${NEWDB}'`'
|
sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) -e 'CREATE DATABASE `'${NEWDB}'`'
|
||||||
for table in ${BACKUPDIR}/${DB}/*; do gunzip -c $table | sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) ${NEWDB}; done
|
for table in ${BACKUPDIR}/${DB}/*; do gunzip -c $table | sudo mysql -u admin -p$(cat /etc/psa/.psa.shadow) ${NEWDB}; done
|
||||||
|
|
Loading…
Reference in New Issue