Protect the password when using Mysql in an unattended bash-script -


i writing bash script (for cron job) uses mysql:

mysql -uusername -ppassword -e 'something;' 

i looking way keep password handy use in script, in manner keep information secure other users on system. users use ps -ef , users might read text files...

so how can safeguard passwords used in automated script on linux?

put settings in option file. can use default ~/.my.cnf file, or can specify alternate file using --defaults-file==filename. see documentation 4.2.3.4. command-line options affect option-file handling

the option file contains default settings mysql commands. can put following in it, example.

[mysql] user=username password=password database=yourdb 

make option file readable you, other users can't see password.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -