How to Install MySQLTuner.pl

MySQLTuner is a perl script so Perl needs to be present on your system.
To find out if you have perl:
which perl
should respond with a path to perl, like:
/usr/bin/perl

We want to install MySQLTuner so we can execute it from any location.

As root user, check your environment.
env |grep PATH [ENTER]

That should displah something like:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

cd /usr/local/bin/
wget http://mysqltuner.com/mysqltuner.pl

NOTE: one of the reasons to acquire mysqltuner.pl from the URL above, is
simple … one gets the lastest version – which is, at time of these posting,
is 1.7.13.

After the mysqltuner.pl file has been downloaded …
chmod +x mysqltuner.pl

That makes it executable.

We want to shorten the use of mysqltuner.pl by creating a small bash
shell script called ‘tuner’ to run mysqltuner.pl.

nano tuner
mysqltuner.pl -user=[SUPERUSER] -pass='[SUPERUSERPASSWORD’ –nocolor

where [SUPERUSER] is your superuser for MySQL … like ‘root’.
It is the user that has all privileges.

and were [SUPERUSERPASSWORD] is the password for the [SUPERUSER].

Save ‘tuner’ … [CTRL][x]

Make ‘tuner’ executable:
chmod u+x tuner

Note: the tuner script and mysqltuner.pl are now executable by the root user ONLY.
To run either one must be the root user.

Now you can run tuner as soon as you login to the system.

Type: tuner [ENTER]

Some things to look at for Moodle:

[!!] /var/log/mysqld.log contains 11 warning(s).
[!!] /var/log/mysqld.log contains 5 error(s)

In ——– Performance Metrics

The server from which this was run is an 8Gig memory machine that’s
an all in one … apache, moodle code, and MySQL on same server.
The goal is to get MySQL to use as much memory as possible, while
leaving enough memory for other server processes.

[–] Physical Memory : 7.6G
[–] Max MySQL memory : 338.9M
[–] Other process memory: 604.2M

[OK] Maximum reached memory usage: 176.9M (2.26% of installed RAM)
[OK] Maximum possible memory usage: 338.9M (4.34% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/3M)
[OK] Highest usage of available connections: 4% (7/151)
Note: the above is what Moodle docs refers to as ‘concurrent’.

[OK] Aborted connections: 0.02% (4/17179

The ‘4’ above were restarts of server or restart of MySQL daemon after changing
configuration file.

——– InnoDB Metrics
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 128.0M/34.6M

The one above is key to getting MySQL databases into memory.
The first number (buffer pool) is what MySQL has to use.
The second number (data size) are your database(s).

You will see this mentioned in Recommendations IF the pool is smaller
than data.

At the bottom of the outpot, are MySQLTuner Recommendations.