Bug #94928 MySQL Workbench Database Export Fail: Workbench unable to get mysqldump version
Submitted: 6 Apr 2019 22:37 Modified: 9 Apr 2019 5:50
Reporter: Jason Atwood Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S3 (Non-critical)
Version:6.3.8 build 1228 CE OS:Ubuntu (18.04 LTS)
Assigned to: CPU Architecture:x86

[6 Apr 2019 22:37] Jason Atwood
Description:
Several attempts to export the contents of a database failed with the following error:
"Workbench unable to get mysqldump version.  Please verify the log file for more information."

I don't have the contents of /.mysql/workbench/log/wb.log containing the specific error message because I've restarted my machine and that appeared to clear the previous log contents.  The error message mentioned a Python file /usr/lib/mysql-workbench/modules/wb_admin_export.py [line 114] could not find the mysqldump version from /usr/bin/mysqldumpget_mysqldump 
mysql  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)

python3 --version
Python 3.6.7

python --version
Python 2.7.15rc1

mysql --version
mysql  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)

mysqldump --version
mysqldump  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)

mysql-workbench --version
MySQL Workbench CE (GPL) 6.3.8 CE build 1228

How to repeat:
Use mysql and mysqldump 8.0.15 on ubuntu 18.04 with workbench 6.3.8

Navigate to data export in workbench

Click 'Start Export'

Suggested fix:
The function, get_mysqldump_version() in /usr/lib/mysql-workbench/wb_admin_export.py uses the following regex pattern to look for the mysqldump --version output: ".*Distrib ([\d.a-z]+).*"
I found this pattern to be incompatible with the current output of mysqldump --version:
"mysqldump  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)"

This function expects re.match() to return a match group like this: "8.0.15".

I found the following code to work after writing out my edits to wb_admin_export.py, deleting wb_admin_export.pyc, and restarting my computer.  Comments on my changes are inline below.

def get_mysqldump_version():
    path = get_path_to_mysqldump()
    if not path:
        log_error("mysqldump command was not found, please install it or configure it in Edit -> Preferences -> MySQL")
        return None
      
    output = StringIO.StringIO()
    rc = local_run_cmd('"%s" --version' % path, output_handler=output.write)
    output = output.getvalue()
    
    if rc or not output:
        log_error("Error retrieving version from %s:\n%s (exit %s)"%(path, output, rc))
        return None
    """
    ***BUG FIX***
    Commented out the re match pattern below, it could not properly find the mysqldump version number.
    It appears the format for mysqldump --version output changed
    Current output for mysqldump --version is:
    mysqldump --version: mysqldump  Ver 8.0.15 for Linux on x86_64 (MySQL Community Server - GPL)
    """
    # s = re.match(".*Distrib ([\d.a-z]+).*", output)
    s = re.search(r'(\d+.\d+.\d+)', output)

    if not s:
        log_error("Could not parse version number from %s:\n%s"%(path, output))
        return None
    """
    ***BUG FIX***
    Commented out code that was not compatible with my fix and added code to grab version number
    from the re match group
    """
    # version_group = s.groups()[0]
    version_group = s.group(0)
    major, minor, revision = [int(i) for i in version_group.split(".")[:3]]
    return Version(major, minor, revision)
[6 Apr 2019 22:39] Jason Atwood
I believe this issue to be linked with the following bug reports:
https://bugs.mysql.com/bug.php?id=87785
https://bugs.mysql.com/bug.php?id=91079
[9 Apr 2019 5:50] MySQL Verification Team
Hello Jason,

Thank you for the report.
This issue is seen(confirmed on Win7 with WB 6.3.8 and mysqldump version 8.0.15 i.e used other than what is bundled with WB) only when you try to use latest mysqldump instead of bundled mysqldump with WB 6.3.8 and no issues observed when using latest WB GA 8.0.15.

- Slight diff error message on windows:

11:08:39 [ERR][wb_admin_export.py:get_mysqldump_version:117]: Could not parse version number from D:\MySQL\mysql-8.0.15-winx64\bin\mysqldump.exe:
mysqldump  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)
11:08:39 [ERR][wb_admin_export.py:get_mysqldump_version:117]: Could not parse version number from D:\MySQL\mysql-8.0.15-winx64\bin\mysqldump.exe:
mysqldump  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)
11:08:45 [ERR][wb_admin_export.py:get_mysqldump_version:117]: Could not parse version number from D:\MySQL\mysql-8.0.15-winx64\bin\mysqldump.exe:
mysqldump  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)

 
Please note that we don't fix bugs in old versions, don't backport bug fixes, so need to check with latest version anyway. So, please, upgrade WB to 8.0.15 and inform us if your problem still exists.

At the most this can be converted to a doc bug because I didn't find any reference in manual confirming that older WB cannot use latest mysqldump.

regards,
Umesh