LP #1435370: pt-show-grants fails against MySQL-5.7.6

Description

**Reported in Launchpad by Simon J Mudd last update 07-12-2016 14:55:36

MySQL 5.7.6 changes the MySQL grant tables and as such this breaks pt-show-grants.

The Password column has gone and is replaced by a new column called authentication_string which currently stores the same hash as before.

[myuser@myserver ~]$ pt-show-grants | grep root.@.localhost
– Grants for 'root'@'localhost'
GRANT ALL PRIVILEGES ON . TO 'root'@'localhost' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION;
[myuser@myserver ~]$ rpm -q percona-toolkit
percona-toolkit-2.2.13-1.noarch
[myuser@myserver ~]$

This is because now the output of SHOW GRANTS FOR 'root'@'localhost shows only:

root@myserver [(none)]> show grants for 'root'@'localhost';
---------------------------------------------------------------------

Grants for root@localhost

---------------------------------------------------------------------

GRANT ALL PRIVILEGES ON . TO 'root'@'localhost' WITH GRANT OPTION

GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION

---------------------------------------------------------------------
2 rows in set (0.00 sec)

So no password is shown. I'm not 100% sure if that's a bug or not (and may report it to Oracle).

You can see the password info if needed this way:

root@myserver [mysql]> select User,Host,authentication_string from user where User='root';
------------------------------------------------------------

User

Host

authentication_string

------------------------------------------------------------

root

localhost

*B9xxxxxxxxxxxxxxxxxxxxxxxxxxx8B

------------------------------------------------------------
1 row in set (0.00 sec)

So some sort of patch would be good to make pt-show-grants continue to show the information while people are testing 5.7.

root@myserver [mysql]> select @@version;
-------------------------

@@version

-------------------------

5.7.6-log

-------------------------
1 row in set (0.00 sec)

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 24, 2018 at 2:38 PM

**Comment from Launchpad by: Max Bowsher on: 07-12-2016 14:55:35

It seems a proper fix is in Git for 2.2.20.

lpjirasync January 24, 2018 at 2:38 PM

**Comment from Launchpad by: Jonathan Nicol on: 11-10-2016 19:22:47

This is not fixed in 2.2.19, for MariaDB 10.0

– Grants dumped by pt-show-grants
– Dumped from server foo via TCP/IP, MySQL 10.0.26-MariaDB at 2016-10-11 19:19:45
Use of uninitialized value $create in substitution (s///) at /usr/bin/pt-show-grants line 1937.

lpjirasync January 24, 2018 at 2:38 PM

**Comment from Launchpad by: Mahesh Patil on: 22-09-2016 06:14:28

Hello,

I am using Percona toolkit : 2.2.19, I want to store all GRANTs in a file, I am stuck with this error. It's not fixed ? What is the workaround?

[root@warehouse dba]# pt-show-grants -umpDBA --ask-pass > grants.sql
Enter password:
Error ## Use of uninitialized value $create in substitution (s///) at /usr/bin/pt-show-grants line 1937, <STDIN> line 1.
[root@warehouse dba]# mysql -umpDBA -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 292265
Server version: 5.7.9-log MySQL Community Server (GPL)

lpjirasync January 24, 2018 at 2:38 PM

**Comment from Launchpad by: NJ Johansson on: 20-06-2016 09:20:27

I just bumped into the same issue with MariaDB 10.1.14 and Percona tools 2.2.17:

  1. pt-show-grants

    • Grants dumped by pt-show-grants

    • Dumped from server Localhost via UNIX socket, MySQL 10.1.14-MariaDB at 2016-06-20 11:15:03
      Use of uninitialized value $create in substitution (s///) at /bin/pt-show-grants line 1923.

  1. pt-show-grants --version
    pt-show-grants 2.2.17

lpjirasync January 24, 2018 at 2:38 PM

**Comment from Launchpad by: Markus Kienel on: 01-04-2016 22:51:32

Problem exists on Jessie with Maria-DB 10.1.13 also.

– Grants dumped by pt-show-grants
– Dumped from server Localhost via UNIX socket, MySQL 10.1.13-MariaDB-1~jessie at 2016-04-02 00:29:40

  1. pt_show_grants:1905 20196 Checking user ''@'localhost'

  2. pt_show_grants:1915 20196 DBD::mysql::db selectcol_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER ''@'localhost'' at line 1 [for Statement "SHOW CREATE USER ''@'localhost'"] at /usr/bin/pt-show-grants line 1912.
    #

  3. pt_show_grants:1918 20196 CreateUser: $VAR1 = [];
    #
    Use of uninitialized value $create in substitution (s///) at /usr/bin/pt-show-grants line 1923.

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 2:37 PM
Updated January 24, 2018 at 2:38 PM
Resolved January 24, 2018 at 2:37 PM