Bash Shell Scripting this and that • Russwurm

Bash Shell Scripting this and that

Created: | Updated:

Database dump without entering the password

Pretty useful if you want to take a dump of the database within a script and do not want to enter the password manually.

Add the file .my.cnf to the users folder with permissions set to 600.

Add this to the .my.cnf file:

[mysqldump]
user=mysqluser
password=secret

Command not found issue in scripts

You might find that you get command not found when executing your script. Especially empty lines are issuing the error. Working on a Windows machine to edit your scripts might be the root cause. Just convert your script from DOS to Unix and you are good again.
yum install dos2unix
dos2unix yourfile.sh