Skip to content

Instantly share code, notes, and snippets.

@alexalouit
Last active April 22, 2018 08:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alexalouit/b5abf51378846462618f to your computer and use it in GitHub Desktop.
Save alexalouit/b5abf51378846462618f to your computer and use it in GitHub Desktop.
Automatically repair and optimize MySQL
#!/bin/sh
#
# cron ex: 0 0 1 * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/mysql-health.sh >> /root/scripts/cron.log
/usr/bin/mysqlcheck --silent --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment