docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.47k stars 2.2k forks source link

Run mysqltuner.pl inside #1089

Closed GMELUM closed 2 months ago

GMELUM commented 2 months ago

I'm trying to run mysqltuner.pl inside my MySQL Docker image to analyze its configuration, but I'm hitting a wall. Neither Perl nor wget are working inside the image. What should I do to get this working?

I'm trying to do this:

docker exec -t -i mysql /bin/bash
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
perl mysqltuner.pl
LaurentGoderre commented 2 months ago

If you are using the default variant (oraclelinux) you need to use this first

microdnf install wget perl
tianon commented 2 months ago

Looking at https://github.com/major/MySQLTuner-perl, I would actually suggest you run MySQL tuner in a separate container (perhaps the perl images are of interest to you? :eyes:) and use --host to connect to it via Docker's network (just like any other application using the database might).

GMELUM commented 2 months ago

For me, the solution was:

microdnf install wget perl

I didn't consider the second option because I suspect that the Perl script would require full access to the server, processor and RAM information.

tianon commented 2 months ago

https://github.com/major/MySQLTuner-perl#specific-usage suggests that even locally, they prefer connecting via TCP, so that's not likely :eyes: