Diferencia entre revisiones de «MySQL»

De gacq wiki
Saltar a: navegación, buscar
(Hot backup - All databases)
(Hot backup - All databases)
Línea 8: Línea 8:
 
=Scripts=
 
=Scripts=
 
==Hot backup - All databases==
 
==Hot backup - All databases==
  output="/srv/backup/mysql"
+
  #!/bin/sh
  fecha=`date +%F_%T | tr \: _`
+
# by gacq
cd $output
+
#
  mysqldump --all-databases --password=passwd | gzip > all-databases-${hoy}.sql.gz
+
# MySQL root password
  find $output -type f -name "all-databases.*.sql" -ctime 8 -exec rm -f {} \;
+
PASSWORD=$1
 +
 +
# Delete backups older than the number of days specified in DAYS
 +
DAYS=8
 +
 +
OUTPUTDIR="/srv/backup/mysql"
 +
   
 +
date=`date +%F_%T | tr \: _`
 +
  mysqldump --all-databases --password=$PASSWORD | gzip > $OUTPUTDIR/all-databases-${date}.sql.gz
 +
 +
# Delete older backups
 +
  find $OUTPUTDIR -type f -name "all-databases.*.sql" -ctime $DAYS -exec rm -f {} \;
 +
 
 +
==Hot backup - One database==
 +
#!/bin/sh
 +
# by gacq
 +
#
 +
# MySQL root password
 +
PASSWORD=$1
 +
DATABASE=$2
 +
 +
# Delete backups older than the number of days specified in DAYS
 +
DAYS=8
 +
 +
OUTPUTDIR="/srv/backup/mysql"
 +
 +
date=`date +%F_%T | tr \: _`
 +
mysqldump --password=$PASSWORD $DATABASE | gzip > $DATABASE-${date}.sql.gz
 +
 +
# Delete older backups
 +
find $OUTPUTDIR -type f -name "all-databases.*.sql" -ctime $DAYS -exec rm -f {} \;

Revisión del 19:14 11 sep 2006

Tools

  • PHPMyAdmin

Common task

Change password

set password = password("yournewpassword");

Scripts

Hot backup - All databases

#!/bin/sh
# by gacq
#
# MySQL root password
PASSWORD=$1

# Delete backups older than the number of days specified in DAYS
DAYS=8

OUTPUTDIR="/srv/backup/mysql"

date=`date +%F_%T | tr \: _`
mysqldump --all-databases --password=$PASSWORD | gzip > $OUTPUTDIR/all-databases-${date}.sql.gz

# Delete older backups
find $OUTPUTDIR -type f -name "all-databases.*.sql" -ctime $DAYS -exec rm -f {} \;

Hot backup - One database

#!/bin/sh
# by gacq
#
# MySQL root password
PASSWORD=$1
DATABASE=$2

# Delete backups older than the number of days specified in DAYS
DAYS=8

OUTPUTDIR="/srv/backup/mysql"

date=`date +%F_%T | tr \: _`
mysqldump --password=$PASSWORD $DATABASE | gzip > $DATABASE-${date}.sql.gz

# Delete older backups
find $OUTPUTDIR -type f -name "all-databases.*.sql" -ctime $DAYS -exec rm -f {} \;