Bug #104375 MySQLShell util.loadDump() doesn't recognise users like 'username'@'1.2.3.4'
Submitted: 21 Jul 2021 8:24 Modified: 28 Jul 2021 16:04
Reporter: IGG t Email Updates:
Status: Closed Impact on me:
None 
Category:Shell Dump & Load Severity:S3 (Non-critical)
Version:8.0.25, 8.0.26 OS:Any
Assigned to: CPU Architecture:Any
Tags: loadDump, username

[21 Jul 2021 8:24] IGG t
Description:
Recently when trying to restore a backup taken using util.dumpInstance I came across the following error:

Util.loadDump: Invalid syntax in account name 'DumpTest1@1.2.3.4/255.0.0.0' (RuntimeError)

It seems that it doesn't like users in the form of  

'username'@'1.2.3.4/255.0.0.0'

This causes a problem for us as all our users are restricted to access from within our network IP range.

How to repeat:
Create two users:

CREATE USER 'DumpTest1'@'1.2.3.4/255.0.0.0' IDENTIFIED BY '************';
GRANT ALL PRIVILEGES ON *.* TO 'DumpTest1'@'1.2.3.4/255.0.0.0';
(change IP range to match your network IP's)

CREATE USER 'DumpTest2'@'127.0.0.1' IDENTIFIED BY '************';
GRANT ALL PRIVILEGES ON *.* TO 'DumpTest2'@'127.0.0.1';

Take a backup of a database using dumpInstance().

Now log into the (localhost) server using 

\c DumpTest1@1.2.3.4:3306
(IP Address of the server)

and try to restore the backup. It results in the error:

Util.loadDump: Invalid syntax in account name 'DumpTest1@1.2.3.4/255.0.0.0' (RuntimeError)

Now repeat, but logging in with the other user:

\c DumpTest2@127.0.0.1:3306

and this time the process works fine.

Suggested fix:
allow mysqlsh to recognise all users
[22 Jul 2021 10:01] MySQL Verification Team
Hello!

Thank you for the report and feedback.

Thanks,
Umesh
[28 Jul 2021 16:04] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.27:

 When a MySQL user account name included a netmask as part of the host value, &mysqlshell;'s dump loading utility util.loadDump() did not handle this correctly when initializing the load operation. As a result, user accounts with a netmask could not be used to run the utility. The issue has now been fixed.