Percona 5.6 mysql_upgrade calls mysqlcheck again after flush privileges
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
||||
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.1 |
Invalid
|
Undecided
|
Unassigned | |||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Incomplete
|
Undecided
|
Unassigned | |||
5.7 |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
To reproduce the bug:
- Install a Percona 5.6.16 sandbox
- Install a Percona 5.5.36 sandbox
- Stop both servers
- Copy 5.5.36 data dir to 5.6.16 data dir
- Start 5.6.16 with --skip-grant-tables
sandboxes/
- Verify that grant tables are skipped by connecting to it as peiran.song which is not a mysql user, and run "show grants".
sandboxes/
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.16-
...
mysql [localhost] {peiran.song} ((none)) > show grants;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
- Run the mysql_upgrade from the 5.6.16 bin directory. Note that, in the cnf file, user/password are commented out.
5.6.16/bin$ ./mysql_upgrade --defaults-
At the end of the upgrade, it reported connection error for root@localhost without password:
Running 'mysql_
Running 'mysqlcheck' with connection arguments: '--port=5616' '--socket=
./mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed
- Double check that grant tables are no longer skipped by connecting to it again as peiran.song. And indeed, connection is rejected this time.
sandboxes/
ERROR 1045 (28000): Access denied for user 'peiran.
tags: | added: pkg |
summary: |
- Percona 5.6 mysql_upgrade overwrites skip-grant-table + Percona 5.6 mysql_upgrade calls mysqlcheck again after flush privileges |
Changed in percona-server: | |
status: | New → Confirmed |
tags: | added: i41728 |
mysql_upgrade is supposed to flush privileges. The culprit seems that the tested version calls mysqlcheck again after flush privileges, and so unable to connect to the server as root without password.
The output from running mysql_upgrade from Percona 5.6 package is as below where mysqlcheck is invoked again after running mysql_fix_ privilege_ tables.
Looking for 'mysql' as: ./mysql /tmp/mysql_ sandbox5616. sock' /tmp/mysql_ sandbox5616. sock' zone_transition _type OK fix_privilege_ tables' ... /tmp/mysql_ sandbox5616. sock'
Looking for 'mysqlcheck' as: ./mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=5616' '--socket=
Running 'mysqlcheck' with connection arguments: '--port=5616' '--socket=
mysql.columns_priv OK
... ...
mysql.time_
mysql.user OK
Running 'mysql_
Running 'mysqlcheck' with connection arguments: '--port=5616' '--socket=
./mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed
The output from running mysql_upgrade from community v5.5.37 is as below, where running mysql_fix_ privilege_ tables is the last item.
Looking for 'mysql' as: ./mysql /tmp/mysql_ sandbox5537. sock' /tmp/mysql_ sandbox5537. sock' fix_privilege_ tables' ...
Looking for 'mysqlcheck' as: ./mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=5537' '--socket=
Running 'mysqlcheck' with connection arguments: '--port=5537' '--socket=
mysql.columns_priv OK
... ...
mysql.user OK
test.a OK
test.company OK
Running 'mysql_
OK