MySQLTuner-perl ==== [![Stato della build - Master](https://travis-ci.org/major/MySQLTuner-perl.svg?branch=master)](https://travis-ci.org/major/MySQLTuner-perl) [![Stato del progetto](http://opensource.box.com/badges/active.svg)](http://opensource.box.com/badges) [![Stato del progetto](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges) [![Tempo medio per la soluzione di problemi](http://isitmaintained.com/badge/resolution/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Average time to resolve an issue") [![Percentuale di problemi non risolti](http://isitmaintained.com/badge/open/major/MySQLTuner-perl.svg)](http://isitmaintained.com/project/major/MySQLTuner-perl "Percentage of issues still open") [![Licenza GPL](https://badges.frapsoft.com/os/gpl/gpl.png?v=103)](https://opensource.org/licenses/GPL-3.0/) **MySQLTuner** è uno script Perl che permette di analizzare velocemente una installazione di MySQL, nonché di apportare modifiche per migliorare le prestazioni e la stabilità. In modo coinciso sono riportati lo stato attuale delle variabili di configurazione e i dati sullo stato del sistema, corredati da suggerimenti di base per il miglioramento delle prestazioni. **MySQLTuner** supporta, in quest'ultima versione, circa 250 indicatori per i server MySQL/MariaDB/Percona. **MySQLTuner** è attivamente manutenuto e nuovi indicatori sono aggiunti di settimana in settimana, supportando un gran numero di configurazioni tra le quali ![Galera Cluster](http://galeracluster.com/), ![TokuDB](https://www.percona.com/software/mysql-database/percona-tokudb), ![ Performance schema](https://github.com/mysql/mysql-sys), metriche relative al SO Linux, ![InnoDB](http://dev.mysql.com/doc/refman/5.7/en/innodb-storage-engine.html), ![MyISAM](http://dev.mysql.com/doc/refman/5.7/en/myisam-storage-engine.html), ![Aria](https://mariadb.com/kb/en/mariadb/aria/), ... Maggiori dettagli sugli indicatori ![Indicators description](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md). ![MysqlTuner](https://github.com/major/MySQLTuner-perl/blob/master/mysqltuner.png) MySQLTuner ha bisogno di te: === **MySQLTuner** ha bisogno di collaboratori per la documentazione, il codice e suggerimenti.. * Problemi e suggerimenti possono essere riportati su [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). * La guida per contribuire è disponibile in inglese: [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md) * Dai un Stella a **MySQLTuner project** su [GitHub](https://github.com/major/MySQLTuner-perl) Compatibilità: ==== * MySQL 5.7 (pieno supporto) * MySQL 5.6 (pieno supporto) * MySQL 5.5 (pieno supporto) * MariaDB 10.1 (pieno supporto) * MariaDB 10.0 (pieno supporto) * Percona Server 5.6 (pieno supporto) * Percona XtraDB cluster (pieno supporto) * MySQL 3.23, 4.0, 4.1, 5.0, 5.1 (supporto parziale - versione deprecata) * Perl 5.6 o successivi (col pacchetto [perl-doc](http://search.cpan.org/~dapm/perl-5.14.4/pod/perldoc.pod)) * Sistemi operativi basati su Unix/Linux (testato su Linux, varianti di BSD e di Solaris) * Windows non è supportato al momento (gradito aiuto!!!!!) * Accesso completo in lettura al server MySQL (accesso root a livello di SO raccomandato per MySQL < 5.1) * supporto al rilevamento di vulnerabilità CVE da [https://cve.mitre.org](https://cve.mitre.org) ***ATTENZIONE*** -- È **estremamente importante** che tu capisca appieno ogni singola modifica apportata alla configurazione del server MySQL. Qualora non capissi appieno qualche parte dell'output dello script o se non capissi quanto raccomandato **dovresti consultare** un DBA esperto o un amministratore di sistema di cui hai fiducia. Testa **sempre** le modifiche su ambienti ad hoc e tieni sempre presente che miglioramenti in un settore potrebbero **influenzare negativamente** MySQL in altri settori. **Seriamente - consulta la sezione FAQ che segue.** What MySQLTuner is checking exactly ? -- All checks done by **MySQLTuner** are documented in [MySQLTuner Internals](https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md) documentation. Download/Installation -- You can download the entire repository by using 'git clone' followed by the cloning URL above. The simplest and shortest method is: wget http://mysqltuner.pl/ -O mysqltuner.pl wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv perl mysqltuner.pl Of course, you can add the execute bit (`chmod +x mysqltuner.pl`) so you can execute it without calling perl directly. Specific usage -- __Usage:__ Minimal usage locally perl mysqltuner.pl __Usage:__ Minimal usage remotely perl mysqltuner.pl --host targetDNS_IP --user admin_user --pass admin_password __Usage:__ Enable maximum output information around MySQL/MariaDb without debugging perl mysqltuner.pl --verbose perl mysqltuner.pl --buffers --dbstat --idxstat --sysstat --pfstat __Usage:__ Enable CVE vulnerabilities check for your MariaDB or MySQL version perl mysqltuner.pl --cvefile=vulnerabilities.csv __Usage:__ Write your result in a file with information displayed perl mysqltuner.pl --outputfile /tmp/result_mysqltuner.txt __Usage:__ Write your result in a file **without outputting information** perl mysqltuner.pl --silent --outputfile /tmp/result_mysqltuner.txt __Usage:__ Using template model to customize your reporting file based on [Text::Template](https://metacpan.org/pod/Text::Template) syntax. perl mysqltuner.pl --silent --reportfile /tmp/result_mysqltuner.txt --template=/tmp/mymodel.tmpl __Usage:__ Enable debugging information perl mysqltuner.pl --debug FAQ -- **Question: Will MySQLTuner fix my slow MySQL server?** **No.** MySQLTuner is a read only script. It won't write to any configuration files, change the status of any daemons, or call your mother to wish her a happy birthday. It will give you an overview of your server's performance and make some basic recommendations about improvements that you can make after it completes. *Make sure you read the warning above prior to following any recommendations.* **Question: Can I fire my DBA now?** **MySQLTuner will not replace your DBA in any form or fashion.** If your DBA constantly takes your parking spot and steals your lunch from the fridge, then you may want to consider it - but that's your call. **Question: Why does MySQLTuner keep asking me the login credentials for MySQL over and over?** The script will try its best to log in via any means possible. It will check for ~/.my.cnf files, Plesk password files, and empty password root logins. If none of those are available, then you'll be prompted for a password. If you'd like the script to run in an automated fashion without user intervention, then create a .my.cnf file in your home directory which contains: [client] user=someusername pass=thatuserspassword Once you create it, make sure it's owned by your user and the mode on the file is 0600. This should prevent the prying eyes from getting your database login credentials under normal conditions. If a [T-1000 shows up in a LAPD uniform](https://en.wikipedia.org/wiki/T-1000) and demands your database credentials, you won't have much of an option. **Question: Is there another way to secure credentials on latest MySQL and MariaDB distributions ?** You could use mysql_config_editor utilities. $ mysql_config_editor set --login-path=client --user=someusername --password --host=localhost Enter passord: ******** $ At this time, ~/.mylogin.cnf has been written with appropriated rigth access. To get information about stored credentials, use the following command: $mysql_config_editor print [client] user = someusername password = ***** host = localhost **Question: What's minimum privileges needed by a specific mysqltuner user in database ?** mysql>GRANT SELECT, PROCESS,EXECUTE, REPLICATION CLIENT,SHOW DATABASES,SHOW VIEW ON *.* FOR 'mysqltuner'@'localhost' identified by pwd1234; **Question: It's not working on my OS! What gives?!** These kinds of things are bound to happen. Here are the details I need from you in order to research the problem thoroughly: * OS and OS version * Architecture (x86, x86_64, IA64, Commodore 64) * Exact MySQL version * Where you obtained your MySQL version (OS package, source, etc) * The full text of the error * A copy of SHOW VARIABLES and SHOW GLOBAL STATUS output (if possible) **Question: How to perform a CVE vulneralibity checks ?** * Download vulnerabilities.csv from this repository. * use option --cvefile to perform CVE checks **Question: How to use mysqltuner from remote host ?** Thanks to [@rolandomysqldba](http://dba.stackexchange.com/users/877/rolandomysqldba) * You will still have to connect like a mysql client: Connection and Authentication --host Connect to a remote host to perform tests (default: localhost) --socket Use a different socket for a local connection --port Port to use for connection (default: 3306) --user Username to use for authentication --pass Password to use for authentication --defaults-file defaulfs file for credentials Since you are using a remote host, use parameters to supply values from the OS --forcemem Amount of RAM installed in megabytes --forceswap Amount of swap memory configured in megabytes * You may have to contact your remote SysAdmin to ask how much RAM and swap you have If the database has too many tables, or very large table, use this: --skipsize Don't enumerate tables and their types/sizes (default: on) (Recommended for servers with many tables) MySQLTuner and Vagrant -- **MySQLTuner** contains following Vagrant configurations: * Fedora Core 23 / MariaDB 10.0 * Fedora Core 23 / MariaDB 10.1 * Fedora Core 23 / MySQL 5.6 * Fedora Core 23 / MySQL 5.7 **Vagrant File** are stored in Vagrant subdirectory. * Follow this 2 steps after vagrant installation: * Rename VagrantFile_for_Mxxx into Vagrantfile * vagrant up **MySQLTuner** contains a Vagrant configurations for test purpose and development * Install VirtualBox and Vagrant * https://www.virtualbox.org/wiki/Downloads * https://www.vagrantup.com/downloads.html * Clone repository * git clone https://github.com/major/MySQLTuner-perl.git * Install Vagrant plugins vagrant-hostmanager and vagrant-vbguest * vagrant plugin install vagrant-hostmanager * vagrant plugin install vagrant-vbguest * Add Fedora Core 23 box for official Fedora Download Website * vagrant box add --name fc23 https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box * Create a data directory * mkdir data * Rename Vagrantfile_MariaDB10.0 into Vagrantfile * cp MySQLTuner-perl/Vagrant/Vagrantfile_for_MariaDB10.0 Vagrantfile * Start vagrant * vagrant up MySQLTuner needs you -- **MySQLTuner** needs contributors for documentation, code and feedbacks.. * Please join us on issue track at [GitHub tracker](https://github.com/major/MySQLTuner-perl/issues). * Contribution guide is avalaible following [MySQLTuner contributing guide](https://github.com/major/MySQLTuner-perl/blob/master/CONTRIBUTING.md) * Star **MySQLTuner project** at [MySQLTuner Git Hub Project](https://github.com/major/MySQLTuner-perl)