MySQLTuner est un script écrit en Perl qui permet d'effectuer une revue de configuration pour MySQL/MAriaDB/PerconaDB rapidement et propose des ajustements pour améliorer la performance et la stabilité du serveur. L'état des variables et statuts est analysé et présenté de manière synthétique et structurée ainsi que plusieurs suggestions basiques concernant la performance.
MySQLTuner supporte dans a dernière version plus de ~300 indicators pour MySQL/MariaDB/Percona Server.
MySQLTuner is maintained and indicator collect is increasing week after week supporting a lot of configuration sush as , , , Linux OS metrics, , , , ...
You can found more details on this indicators .
MySQLTuner needs contributors for documentation, code and feedbacks..
It is extremely important for you to fully understand each change you make to a MySQL database server. If you don't understand portions of the script's output, or if you don't understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust. Always test your changes on staging environments, and always keep in mind that improvements in one area can negatively affect MySQL in other areas.
Seriously - please review the FAQ section below.
All checks done by MySQLTuner are documented in MySQLTuner Internals documentation.
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.
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 syntax.
perl mysqltuner.pl --silent --reportfile /tmp/result_mysqltuner.txt --template=/tmp/mymodel.tmpl
Usage: Enable debugging information
perl mysqltuner.pl --debug
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 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:
Question: How to perform a CVE vulneralibity checks ?
Question: How to use mysqltuner from remote host ? Thanks to @rolandomysqldba
Connection and Authentication
--host <hostname> Connect to a remote host to perform tests (default: localhost)
--socket <socket> Use a different socket for a local connection
--port <port> Port to use for connection (default: 3306)
--user <username> Username to use for authentication
--pass <password> Password to use for authentication
--defaults-file <path> defaulfs file for credentials
Since you are using a remote host, use parameters to supply values from the OS
--forcemem <size> Amount of RAM installed in megabytes
--forceswap <size> Amount of swap memory configured in megabytes
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 contains following Vagrant configurations:
Vagrant File are stored in Vagrant subdirectory.
MySQLTuner contains a Vagrant configurations for test purpose and development
MySQLTuner a besoin de contributeurs pour la documentation, le code, des tests et des retours d'expérience.