Facebook
From Colossal Wolf, 3 Months ago, written in Bash.
Embed
Download Paste or View Raw
Hits: 120
  1. #!/bin/sh
  2. readonly RMNAME="stage.pl2"
  3. readonly RMUSER="dev"
  4. readonly RMPASS="bardzotrudnehaslonumer1"
  5. readonly RMADDR="ajslandum.kom"
  6.  
  7. readonly DBNAME="stage.pl2"
  8. readonly DBUSER="root"
  9. readonly DBPASS="bardzotrudnehaslo"
  10.  
  11. FILENAME=~/dumps/$RMNAME.$RMADDR.`date +%s`.sql
  12.  
  13.  
  14. echo "-- ZRZUCENIE BAZY Z SERWERA"
  15. mysqldump -u $RMUSER -p$RMPASS -h $RMADDR $RMNAME --single-transaction --routines | pv > $FILENAME
  16.  
  17. echo "-- PRZYGOTOWANIE BAZY --"
  18. echo "DROP DATABASE IF EXISTS \`$DBNAME\`; CREATE DATABASE \`$DBNAME\`" | mysql -u$DBUSER -p$DBPASS
  19.  
  20. echo "-- WRZUCANIE DO BAZY --"
  21. pv $FILENAME | mysql $DBNAME -u$DBUSER -p$DBPASS
  22.