/path/to/bin/mysqldump -u $mysqlusername -p$mysqlpassword $mysqldatabasename > backup.sql OR: mysqldump -u user -p —opt database > backup_file Not that there is no space after the -p . If the password was “pass” you would use -ppass