MySQL5.6で-pオプションをつけてコマンド実行するとWarningが表示される

現象

MySQL5.6で、-pオプション付きでmysqldumpコマンドを実行するとWarningが出力されます。
実行はできるのですが、毎回出力されて嫌なので回避したいです。

mysqldump -h #{db_server} -u #{username} -p#{password} #{database} > #{backup_file}
Warning: Using a password on the command line interface can be insecure.

回避方法

以下のように変更しました。

MYSQL_PWD=#{configuration['password']} mysqldump -h #{db_server} -u #{username} #{database} > #{backup_file}

環境変数MYSQL_PWDにパスワードを上書きしておいて、
mysqldumpを実行するという方法です。

参考

日々の覚書: MySQL 5.6以降でクライアントに "Warning: Using a password on the command line interface can be insecure." と言われるのを防ぐいくつかの方法

MySQL :: MySQL 5.6 Reference Manual :: 6.1.2.1 End-User Guidelines for Password Security