0

I recently upgraded my system to Ubuntu 16.04 (including upgrade to MySQL 5.7). Some scripts (for backup) were running silently before but now, I got:

[Warning]: Using a password on the command line interface can be insecure

The offending line is the following, in a script in cron.daily:

mysqldump -uMyUser -pMyPasswd --single-transaction --databases $db > $file

Is it just an new warning from MySQL (= this situation is not new but is now warned) or is something more serious to be taken into account? I want to know if I can ignore this warning or not.

6

I believe that was first included in MySQL 5.6. I don't believe it imposes any additional security threat. However, it should be noted, if your cron entry is exactly how it is above, that command would expose your password on your system to ps and log entries.

I would make the recommendation for cron entries to be put into an external file with proper permissions.

For user access instead of crontab you could create a file ~/.my.cnf with the following contents.

[client]                                                                                                                                                   
user=username                                                                                                                                         
password=password
host=localhost
3

This doesn't seem to be a newer feature, as per this 2013 Stack Overflow question.

The most secure solution is probably to follow bc2946088's advice and store the user information in a file instead.

However, the aforementioned Stack Overflow post offers a solution to avoid the warning message, much like bc2946088 solution, just by a different approach:

If your MySQL client/server version is a 5.6.x a way to avoid the WARNING message are using the mysql_config_editor tools:

mysql_config_editor set --login-path=local --host=localhost --user=username --password

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.