Backup all your MySQL databases with one line of cron photo

Backup your MySQL databases with a one-liner crontab

As I’ve lost some data in my MySQL database recently, I’ve decided to make backups more regularly and I’ve been playing with Cron in Cpanel in order to set up automatic backups of all my databases.

Here’s a short how-to which might help some people out :

Go to Cpanel > Cron Jobs

Select between Standard or Advanced, that’s up to you !

In the command field, type this :

date=`date -I`; mysqldump -u yourusername -p yourpassword --all-databases > /home/LOGIN/backups/xbackup_$date.sql; gzip /home/LOGIN/backups/xbackup_$date.sqlCode language: JavaScript (javascript)

Now let’s see what this all means : the date line formats the date so that we can append it to our backup filename.

We then ask mysql to dump all databases into /home/LOGIN/public_html/backups/xbackup_$date.sql, where :

  • LOGIN is your Cpanel name, using “yourusername” as user (-u) and “yourpassword” as the password (-p).

Notice the date variable inserted in the filename. Finally our SQL file is gzipped using the gzip directive.

You now have to set your backup frequency. And relax !

Notes :

1. I’ve created a user “backup” with all privileges in Cpanel > MySQL databases and associated him with all my databases so that I can backup everything in one single file with just one line of cron.

2. Protect your backup directory so that people cannot download the whole of you SQL data. You can enable directory protection with Cpanel > Password protect directories > *select your backup directory* > *check the box and enter a username/password* > *validate*.

That’s it ! Have fun, you should never have to worry about your databases’ backups again ;-)

Une image d'un pingouin avec de la musique.

Convertir des fichiers MPC en MP3

Dans l’univers audio numérique, divers formats de fichiers coexistent, chacun avec ses avantages et particularités. Le format MPC, connu pour sa haute qualité sonore à des taux de compression élevés, trouve néanmoins ses limites dans sa compatibilité avec les lecteurs multimédias grand public et les dispositifs portables.

C’est ici qu’intervient le besoin de conversion en MP3, format universellement reconnu pour sa compatibilité étendue. Ce guide détaillé vous accompagnera pas à pas dans le processus de conversion de fichiers MPC en MP3 sous Windows, MacOS et Linux, garantissant une expérience fluide et accessible pour tous les utilisateurs.

C’est ici qu’intervient le besoin de conversion en MP3, format universellement reconnu pour sa compatibilité étendue. Ce guide détaillé vous accompagnera pas à pas dans le processus de conversion de fichiers MPC en MP3 sous Windows, MacOS et Linux, garantissant une expérience fluide et accessible pour tous les utilisateurs.

Lire la suite