general database question
-
- User
- Posts: 20
- Joined: Wed Jan 02, 2019 12:46 pm
general database question
just a general question is there a way to split the sql backup file php admin only allows 40 mb
- wbartels
- netjukebox developer
- Posts: 881
- Joined: Thu Nov 04, 2004 3:12 pm
- Location: Netherlands
- Contact:
Re: general database question
Here is my netjukebox database backup script (ubuntu), the live.netjukebox.nl database backup will only cost ± 111 kB.
This script will ignore multiple tables these will be recreated after restore and update netjukebox.
I hope you can use (parts of) the script, otherwise you can ask the same question on a MySQL specific forum.
Good luck with it!
This script will ignore multiple tables these will be recreated after restore and update netjukebox.
I hope you can use (parts of) the script, otherwise you can ask the same question on a MySQL specific forum.
Code: Select all
#!/bin/bash
echo 'Backup database...'
BACKUP="/data/backup/daily"
TODAY="$(date '+%Y-%m-%d')";
mkdir -p "$BACKUP/$TODAY"
export MYSQL_PWD=password
# Compact netjukebox database, ignored data will be recreated after update
nice -n +19 mysqldump -uusername --no-data --databases netjukebox > /tmp/netjukebox.sql
nice -n +19 mysqldump -uusername --no-create-info \
--ignore-table=netjukebox.track \
--ignore-table=netjukebox.bitmap \
--ignore-table=netjukebox.country_ipv4 \
--ignore-table=netjukebox.country_ipv6 netjukebox >> /tmp/netjukebox.sql
echo "UPDATE \`server\` SET \`value\` = '0' WHERE \`name\` = 'geolite2_version' LIMIT 1;" >> /tmp/netjukebox.sql
nice -n +19 gzip /tmp/netjukebox.sql; mv -f /tmp/netjukebox.sql.gz "$BACKUP/$TODAY/netjukebox.sql.gz"