3 liens privés
exp userid=scott/tiger file=export_scott.dump log=export_scott.log owner=scott
imp userid=scott/tiger file=export_scott.dump log=import_scott.log owner=scott
Single base
# backup
mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
# restore
mysql -u root -p[root_password] [database_name] < dumpfilename.sql
All bases :
# backup
mysqldump -u root -ptmppassword --all-databases > /tmp/all-database.sql
# restore
mysql -u root -p[root_password] < dumpfilename.sql
!!! Les schémas doivent être vides avant le restore !!!
Export : export > ~/mon_envir.sh
Import : ~/mon_envir.sh
Sur le client :
/etc/fstab :
<server_ip>:/<export_dir>/ /<local dir>/ nfs soft,timeo=5,intr,rsize=8192,wsize=8192 0 0
commande :
mount -a
Sur le serveur
/etc/exports :
/<export_dir> client_ip(rw,sync,all_squash)
commande :
/usr/sbin/exportfs
si exportfs n'existe pas : apt-get install nfs-kernel-server
save :
sudo -u mysql mysqldump --protocol=socket -S /var/run/mysqld/mysqld.sock --all-databases -p | bzip2 -c > databasebackup.sql.bz2
restore :
bzip2 -d databasebackup.sql.bz2
sudo -u mysql --protocol=socket -S /var/run/mysqld/mysqld.sock < databasebackup.sql
si droits root (création de base, etc...)
sudo -u mysql -u root -p --protocol=socket -S /var/run/mysqld/mysqld.sock < databasebackup.sql