Skip to content

Instantly share code, notes, and snippets.

@josue
Created October 20, 2010 07:46
Show Gist options
  • Save josue/635982 to your computer and use it in GitHub Desktop.
Save josue/635982 to your computer and use it in GitHub Desktop.
MySQL clear query cache via commandline
#!/bin/bash
# Created by: Josue Rodriguez <josue@josuerodriguez.com> (c) 2010.
# Clear MySQL Cache
# Download file into directory "/usr/bin" then run "sudo chmod +x /usr/bin/mysqlclearcache"
mysql_options=$1
if [ "$mysql_options" == "--help" ]; then
echo -e "\nUsage: mysqlclearcache [OPTIONS]\n"
echo -e "- options are same as when you use the regular 'mysql' command."
echo -e "- example: mysqlclearcache -uroot -p ....\n"
else
mysql $mysql_options -e "RESET QUERY CACHE" && echo -e "\nMySQL Cache Query Cleared\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment