Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nestoru/4f684f206c399894952d to your computer and use it in GitHub Desktop.
Save nestoru/4f684f206c399894952d to your computer and use it in GitHub Desktop.

Revisions

  1. nestoru revised this gist Oct 8, 2015. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,4 @@ 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
    # Read more from http://thinkinginsoftware.blogspot.com/2015/10/solution-for-mysql-warning-using.html
  2. nestoru created this gist Oct 8, 2015.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 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