MySQL tuning.sh, updated and improved
Find a file
2024-09-28 11:04:43 +05:30
README.md Update README.md 2024-09-28 11:04:43 +05:30
SECURITY.md Add SECURITY.md 2024-09-28 10:58:31 +05:30
tuning.sh Add tuning.sh 2024-09-28 11:03:14 +05:30

MySQL Tuning.sh

How to use

Download and run tuning.sh.

If you don't like downloading anything and you do like living dangerously, you could instead run it with something like this¹:

curl -L https://git.hhf.technology/hhf/tuning.sh/raw/branch/master/tuning.sh | bash

About this script

This script takes information from SHOW STATUS LIKE... and SHOW VARIABLES LIKE... to produce sane recommendations for tuning server variables.

It (attempts to be!) compatible with all versions of MySQL 3.23 and higher (including 5.x), as well as MariaDB, and Percona Server for MySQL.²

Currently it handles recommendations for the following:

  • Slow Query Log
  • Max Connections
  • Worker Threads
  • Key Buffer [MyISAM only]
  • Query Cache
  • Sort Buffer
  • Joins
  • Temp Tables
  • Table (Open & Definition) Cache
  • Table Locking
  • Table Scans (read_buffer) [MyISAM only]
  • InnoDB Status

Use of this software is governed by its LICENSE, regardless of how it is accessed or by whom it is used. Follow the license, dammit.

Some of the terms used in this script or in the documentation surrounding it may be copyrighted, trademarked, or otherwise owned by external entities including but not limited to Oracle, Percona, MariaDB Corporation Ab, and others. These terms are used solely for identification of products, and the interoperability of this script with these or any other products, even if explicitly claimed, is nonetheless not guaranteed by any author. No affiliation with or licensing from these entities is stated nor implied. Anyone who says otherwise is itchin' for a fight.


Footnotes

¹: Running it without downloading it and reading it first is a truly awful choice, and I arguably shouldn't put this command here. Then again, if you are the sort of person who even wonders how to run a script with root access to your database by piping it into Bash, you're probably the sort of person I can't convince not to do so. At least these instructions are ever-so-slightly safer than what'll appear on some Stack Overflow if I didn't put this here.

²: ... and anything else sufficiently MySQLish to export the status variables it uses to run.