Page 1 of 1

general database question

Posted: Fri May 31, 2024 2:23 pm
by 1islandguy
just a general question is there a way to split the sql backup file php admin only allows 40 mb

Re: general database question

Posted: Wed Jun 12, 2024 3:40 pm
by wbartels
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.

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"
Good luck with it!