Skip to content

Instantly share code, notes, and snippets.

@tony4d
Created October 13, 2015 03:31
Show Gist options
  • Select an option

  • Save tony4d/75d3246592dcbeb389a6 to your computer and use it in GitHub Desktop.

Select an option

Save tony4d/75d3246592dcbeb389a6 to your computer and use it in GitHub Desktop.

Revisions

  1. tony4d created this gist Oct 13, 2015.
    8 changes: 8 additions & 0 deletions mysql-analyze-all-tables.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash

    # To avoid doing things like putting your mysql password on the cli which is not secure
    # Use mysql config editor http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html

    for table in $(mysql --login-path=mylogins -D database_name -Bse "show tables");
    do mysql --login-path=mylogins -D database_name -Bse "analyze table $table";
    done