Bug #81723 installing container with xplugin results in an unresponsive server
Submitted: 4 Jun 2016 8:57 Modified: 14 Jun 2016 8:19
Reporter: Giuseppe Maxia (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Package Repos and Docker Images Severity:S1 (Critical)
Version:5.7.12, 5.7.13 OS:Any
Assigned to: Lars Tangvald CPU Architecture:Any

[4 Jun 2016 8:57] Giuseppe Maxia
Description:
This is similar to Bug#81257, and fails for the same reason.
When the container starts, the initialization scripts issues the command
DELETE FROM mysql.user where user != 'mysql.sys';

This is fine unless you install the Xplugin at the same time:

docker run --name mybox  -e MYSQL_ROOT_PASSWORD=secret -\
   d mysql/mysql-server --plugin-load=mysqlx:mysqlx.so

The plugin is installed, but the account mysqlxsys is deleted (https://dev.mysql.com/doc/refman/5.7/en/document-store-setting-up.html)

Note: there is a timing issue. Sometimes, depending on the speed of the host, the operation succeeds, as the existing users are deleted before the new user is created. 

How to repeat:

docker run --name mybox  -e MYSQL_ROOT_PASSWORD=secret -\
   d mysql/mysql-server --plugin-load=mysqlx:mysqlx.so

Try connecting with mysqlsh

Suggested fix:

Change the statement to:
DELETE FROM mysql.user where user not in ( 'mysql.sys', 'mysqlxsys' );
[7 Jun 2016 13:29] OCA Admin
Contribution submitted via Github - Fix for bug#81723 
(*) Contribution by Giuseppe Maxia (Github datacharmer, mysql-docker/pull/4#issuecomment-224257081): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_72827041.txt (text/plain), 1.02 KiB.

[9 Jun 2016 14:05] Lars Tangvald
Hi,

Thank you for the contribution. It has been included in the image script. Can you verify the bug is fixed?
[9 Jun 2016 14:19] Giuseppe Maxia
Thanks for the quick response. The bug is fixed.