'Can't create an mysqlpump equivalent to mysqldump --all-databases

I want to create logical backups of my mysql instance.

The instance contains a couple of databases and a few users. I want to backup all of them without explicitly listing them in the command.

the command mysqldump --all-databases achieves this correctly but it is slow. I want to move to mysqlpump but I can't get the same result.

mysqlpump \
    --all-databases \
    --routines \
    --events \
    --triggers \
    --single-transaction \
    --add-drop-table \
    > bkp-dbs-routines-events-triggers-drop.sql
# this command works fine but lacks users
# mysqlpump documentation shows the following command to backup users

mysqlpump \
    --exclude-databases=% \
    --users \
    > bkp-users.sql
# import fails with ERROR 1396 (HY000) at line 19: Operation CREATE USER failed for 'mysql.infoschema'@'localhost'

mysqlpump \
    --exclude-databases=% \
    --add-drop-user \
    --users \
    > bkp-users-drop.sql
# import fails with ERROR 1698 (28000) at line 38: Access denied for user 'root'@'localhost'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source