Mysql password on a bash script.

Did this test, nothing fancy, a simple script which reads

 

#!/bin/bash
NUM=1
while [ $NUM != 0 ]; do
mysql -u conn -p123456 db1 -e “INSERT INTO populate VALUES ($NUM)”
let “NUM+=1″
done

Then while this was running, did some checking

[root@db1]# ps -ef | grep pop
root 8625 6729 1 14:51 pts/1 00:00:00 /bin/bash ./populate_sh
root 9043 8625 0 14:52 pts/1 00:00:00 mysql -u conn -px xxxxxx db1 -e INSERT INTO populate VALUES (418)
root 9045 5600 0 14:52 pts/0 00:00:00 grep pop

Notice that the password is masked. This is not saying that it is safe putting your mysql password on a bash script.

Just curious of this. Is the ps invocation insufficient? More on this when more time is available , in the meanwhile, some backup-recovery tests using LVM is in the brewing.

1 Puna »

  1. tanjers sinabi

    ang nerd e!

RSS ulat para sa mga puna sa paskil na ito. · BakasPabalik URI

Mag-iwan ng Puna