The latest stable MySQLTuner script is available in plaintext (36K) and gzipped (10K) versions. Beta versions are available via subversion, and you can find the instructions in the Trac repository.
MySQLTuner has a low-traffic mailing list for new version announcements and bug fixes. To get on the list, simply send an e-mail to email@example.com with SUBSCRIBE in the subject line. The e-mails will appear to come from firstname.lastname@example.org, so please be sure to add it to your e-mail provider’s white list.
Installation and Requirements:
The script is a basic Perl script that has no additional requirements. At this time, MySQLTuner is compatible with Linux/Unix based operating systems with Perl 5.6 or later. MySQL versions 3.23 and later are supported by the script.
To get started, simply download MySQLTuner and make it executable:
# wget http://mysqltuner.com/mysqltuner.pl
# chmod +x mysqltuner.pl
Operating System Repositories
MySQLTuner is now part of many operating systems thanks to help from several package maintainers:
- Fedora 9 and rawhide
Red Hat Enterprise Linux 4/5 (via EPEL repository)
Ubuntu Intrepid Ibex
MySQLTuner is offered completely free, and is distributed under the GPL. If you enjoy using the script, please let me know! If you enjoy it so much that you’d like to make a small donation, you’re welcome to do so:
MySQLTuner is a high-performance MySQL tuning script written in perl that will provide you with a snapshot of a MySQL server’s health. Based on the statistics gathered, specific recommendations will be provided that will increase a MySQL server’s efficiency and performance. The script gives you automated MySQL tuning that is on the level of what you would receive from a MySQL DBA.
This script has been derived from many of the ideas in Matthew Montgomery’s MySQL tuning primer script.
- NEW! Remote server checks: Connects to remote servers to perform tests.
- NEW! Convenient MySQL logins: MySQLTuner will automatically log in to MySQL on servers running Plesk, servers with ~/.my.cnf files, and server without MySQL root passwords. If you need to authenticate manually, you can pass the username and password on the command line or provide the credentials interactively.
- NEW! Manually set memory sizes: Users on virtual environments can now specify how much RAM and swap memory are present so that the script’s calculations will be accurate.
- Memory Usage: Calculates MySQL memory usage at max load and makes recommendations for increasing or decreasing the MySQL memory footprint. Per-thread and server-wide buffer data is calculated separately for an accurate snapshot of the server’s configuration.
- Slow Queries: Reviews the amount of slow queries relative to the total queries. Slow query time limits are also analyzed and recommendations are made.
- Connections: Current and historical connection counts are reviewed.
- Key Buffer: Takes configuration data and compares it to the actual indexes found in MyISAM tables. Key cache hit rates are calculated and variable adjustments are suggested.
- Query Cache: Query cache hit rates and usage percentages are used to make recommendations for the query cache configuration variables.
- Sorting & Joins: Per-thread buffers that affect sorts and joins are reviewed along with the statistics from the queries run against the server.
- Temporary Tables: Variable recommendations are made to reduce temporary tables that are written to the disk.
- Table Cache: Compares total tables opened to the currently open tables. Calculates the table cache hit rate in order to make suggestions.
- Open Files: Determines if the server will approach or run into the open file limit set by the operating system or the MySQL server itself.
- Table Locks: Finds table locking that forces queries to wait and makes suggestions for reducing locks that require a wait.
- Thread Cache: Calculates how many times MySQL must create a new thread to respond to a query.
- Aborted Connections: Finds applications that are not closing connections to MySQL properly.
- Read/Write Ratios: Calculates the percentage of read and write operations on your MySQL installation.