Use canonical MySQL root pwd reset procedure
Use canonical MySQL root pwd reset procedure

Current Implementation:
Trove restores InnoDB backups by operating directly on the file system.
This means that the restored database would still use
the old (and potentially no longer available) root password.
Trove therefore needs to reset the password on the restored databases.
This was originally done by starting the service in the
safe mode (which allows root login without password) and
executing 'SET PASSWORD FOR ...' statement to reset the password.

Proposed Improved Solution:
The recommended generic procedure for resetting a 'forgotten' root
password is documented in the official MySQL doc:
http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html

Added '--skip-grant-tables' to 'mysqld_safe' startup parameters.
That is required for unrestricted access to the user table.
The server can be instructed to start using grant tables at any
time by executing 'FLUSH PRIVILEGES' statement.
Added '--skip-networking' to prevent anybody from sneaking in
across the network while resetting the root password.
Replaced the password-reset statement with a direct user table update
followed by 'FLUSH PRIVILEGES'.
Removed '--protocol' parameter from the mysqladmin shutdown call,
as we started the database with '--skip-networking' and the guestagent
is running locally anyways.
We also check for errors in the password-reset stage,
so that a proper error message (including cause) can be logged.

Tested with MySQL  5.5/5.6 and Percona

Closes-Bug: 1419995
Change-Id: I86777c4177cb46d61573c564335b529d7a1da52a

hplustree/trove,fabian4/trove,zhujzhuo/openstack-trove,openstack/trove,zhujzhuo/openstack-trove,mmasaki/trove,hplustree/trove,zhangg/trove,redhat-openstack/trove,mmasaki/trove,cp16net/trove,zhujzhuo/openstack-trove,openstack/trove,redhat-openstack/trove,cp16net/trove,zhangg/trove,fabian4/trove,mmasaki/trove,fabian4/trove,cp16net/trove,redhat-openstack/trove