MySQL Scripts
Published on 21 Mar 2021
All databases dump
HOST=localhost
USER=__USER__
PASS=__PASS__
BACKUP_DIR=__OUTDIR__
if [ ! -d $BACKUP_DIR ]; then
mkdir -p $BACKUP_DIR
fi
MYSQL_DBS=$(mysqlshow -h $HOST -u $USER -p$PASS | awk ' (NR > 2) && (/[a-zA-Z0-9]+[ ]+[|]/) && ( $0 !~ /mysql/) { print $2 }');
for DB in $MYSQL_DBS ; do
echo "* Backuping MySQL data from $DB@$HOST..."
mysqldump -h $HOST -u $USER -p$PASS $DB > $BACKUP_DIR/mysql_$DB.sql
done
Tables size in MB
SELECT table_schema "table",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
all tags
IDE architecture" cli crontab crypto csv database docker editor error exceptions fastapi ffmpeg filename git go history http iteration javascript linux logging me mysql numpy orm pdo pentaho php postgres python random rename rsync rust selenium server solana sql sqlite ssh typescript user w3m wordpress