-
-
Save purezhi/a409ffbf8707cad8810af6d04a41ae0b to your computer and use it in GitHub Desktop.
Solution for mysql Warning: Using a password on the command line interface can be insecure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let us consider the following typical mysql backup script: | |
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database | |
# It succeeds but stderr will get: | |
# Warning: Using a password on the command line interface can be insecure. | |
# You can fix this with the below hack: | |
credentialsFile=/mysql-credentials.cnf | |
echo "[client]" > $credentialsFile | |
echo "user=$mysqlUser" >> $credentialsFile | |
echo "password=$mysqlPassword" >> $credentialsFile | |
echo "host=$mysqlHost" >> $credentialsFile | |
mysqldump --defaults-extra-file=$credentialsFile --routines --no-data $database | |
# This should not be IMO an error. It is just a 'considered best practice' | |
# Read more from http://thinkinginsoftware.blogspot.com/2015/10/solution-for-mysql-warning-using.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment