Running MySQL Without a Password on the Command Line

When you run a webserver there's always things that could be set up better, for reasons of security, reliability or speed. One of my undone tasks for an embarrassingly long time has been to stop backing up MySQL databases by passing along the username and password to a script at the command line. I was regularly using the mysqldump program to make a backup of each database via a script that contained these commands: OF=/home/[username]/backup/$3-$(date +%Y%m%d).gz mysqldump --user=$1 ... (read more)