1

we are trying to use mysqltuner to have a kind of vision of what could be the problems behind some issues on our Wordpress website but have have few problems when running it (mostly failed to execute / returne code: 256).

First we did:

wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl

and execute it with:

perl mysqltuner.pl

but this is what we get:

 >>  MySQLTuner 1.6.9 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
[!!] failed to execute: SELECT VERSION()
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SHOW /*!50000 GLOBAL */ VARIABLES
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SHOW /*!50000 GLOBAL */ STATUS
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SHOW ENGINES
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SHOW SLAVE STATUS\G
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SHOW SLAVE HOSTS
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: \s
[!!] FAIL Execute SQL / return code: 256
Use of uninitialized value $myvar{"version"} in pattern match (m//) at
    mysqltuner.pl line 1526 (#1)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.

    To help you figure out what was undefined, perl will try to tell you the
    name of the variable (if any) that was undefined. In some cases it cannot
    do this, so it also tells you what operation you used the undefined value
    in.  Note, however, that perl optimizes your program and the operation
    displayed in the warning may not necessarily appear literally in your
    program.  For example, "that $foo" is usually optimized into "that "
    . $foo, and the warning will refer to the concatenation (.) operator,
    even though there is no . in your program.

Use of uninitialized value $mysqlvermajor in numeric gt (>) at mysqltuner.pl
    line 1552 (#1)
Use of uninitialized value $mysqlvermajor in numeric eq (==) at mysqltuner.pl
    line 1552 (#1)
Use of uninitialized value $myvar{"version"} in concatenation (.) or string at
    mysqltuner.pl line 1531 (#1)
[!!] Your MySQL version  is EOL software!  Upgrade soon!
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[!!] failed to execute: SHOW DATABASES
[!!] FAIL Execute SQL / return code: 256
[--] Status: -Archive -BDB -Federated -InnoDB -ISAM -NDBCluster 
[OK] Total fragmented tables: 0
[!!] failed to execute: SELECT ~0
[!!] FAIL Execute SQL / return code: 256

-------- Security Recommendations  -------------------------------------------
Use of uninitialized value $myvar{"version"} in pattern match (m//) at
    mysqltuner.pl line 1345 (#1)
[!!] failed to execute: SELECT CONCAT(user, '@', host) FROM mysql.user WHERE TRIM(USER) = '' OR USER IS NULL
[!!] FAIL Execute SQL / return code: 256
[OK] There are no anonymous accounts for any database users
[!!] failed to execute: SELECT CONCAT(user, '@', host) FROM mysql.user WHERE (password = '' OR password IS NULL) AND plugin NOT IN ('unix_socket', 'win_socket')
[!!] FAIL Execute SQL / return code: 256
[OK] All database users have passwords assigned
[!!] failed to execute: SELECT CONCAT(user, '@', host) FROM mysql.user WHERE CAST(password as Binary) = PASSWORD(user) OR CAST(password as Binary) = PASSWORD(UPPER(user)) OR CAST(password as Binary) = PASSWORD(UPPER(LEFT(User, 1)) + SUBSTRING(User, 2, LENGTH(User)))
[!!] FAIL Execute SQL / return code: 256
[!!] failed to execute: SELECT CONCAT(user, '@', host) FROM mysql.user WHERE HOST='%'
[!!] FAIL Execute SQL / return code: 256
[!!] There is no basic password file list!

-------- CVE Security Recommendations  ---------------------------------------
[--] Skipped due to --cvefile option undefined
Use of uninitialized value $mystat{"Questions"} in numeric lt (<) at
    mysqltuner.pl line 1868 (#1)
[!!] Your server has not answered any queries - cannot continue...

We don't understand what could be the problem. Thanks everyone in advance!

Lightbox
  • 71
  • 2
  • 5
  • Looks like you specified invalid credentials. Did you set any credentials at all? Also, why do you think that a mysql tuner script can detect problems related to wordpress? – Mjh Apr 08 '16 at 14:06
  • Dear @Mjh thanks for your quick reply. We run mysqltuner as root, we were not asked for any credentials. We don't think that mysqltuner could detect Wordpress problems, but we are looking into many variables including: php-fpm slow logs, mysql slow logs and we wanted to check also with mysqltuner if there's any misconfiguration. – Lightbox Apr 08 '16 at 14:13
  • I've tried to run it with : `perl mysqltuner.pl --host localhost --user root` and the first line output is `[--] Performing tests on localhost:3306 [OK] Logged in using credentials passed on the command line`so it looks fine but it keep giving all those failed stats – Lightbox Apr 08 '16 at 14:19
  • If you get it running, ignore what it says about "fragmented tables"; it is bogus. – Rick James Apr 09 '16 at 19:34
  • You might get further by searching this forum for "Wordpress"; there are many discussions about performance, etc; you could listen to what the others discovered. – Rick James Apr 09 '16 at 19:35
  • @RickJames thanks for the advice but we would like to get this tool running properly but we don't know how to solve this problem. – Lightbox Apr 11 '16 at 07:42
  • How long has your WP been running? Much of what mysqltuner works with is 'counters' (`SHOW GLOBAL STATUS`). They are pretty useless on new or little-used systems; they essentially say "everything is OK". – Rick James Apr 11 '16 at 18:47
  • Ok good to know :) – Lightbox Apr 12 '16 at 07:38

1 Answers1

0

I had the same error due to changing the listen port / renaming the root user & disabling passwordless local logins but fixed it with:

/path/to/mysqltuner.pl --port xxxx --user xxxx --pass xxxx

(localhost is assumed without the --host switch & port 3306 is assumed without a --port switch)

A better way to run mysqltuner is to setup a /root/.my.cnf with some credentials for a limited_user (any name will work):

[client]
user=limited_user
pass=thatuserspassword

I was then able to run with a limited_user:

/path/to/mysqltuner.pl --port 5555 --user limited_user

The limited_user only needs permissions to:

SHOW DATABASES, LOCK TABLES, SELECT ON *.*

& optionally SHOW SLAVE STATUS & SHOW SLAVE HOSTS

Stuart Cardall
  • 2,099
  • 24
  • 18