Original code copyright (C) 2009-2022 Rudolf Cardinal (

This file is part of cardinal_pythonlib.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

*Converts a .MDB file (Microsoft Access) database to MySQL, copying structure and data.*

Uses the mdb-tools package.

Under Ubuntu, the following packages are required:

though you may also want these, if you’re planning to use Python/ODBC with MySQL:

What works:

  • schema copied

  • data copied

What doesn’t work:

  • indexes are not described by mdb-schema, so these must be recreated

  • relationships are not supported by mdb-schema, so these must be recreated

We’ll do this with calls to other command-line tools. See


  • REVISED 1 Jan 2013: mdb-schema syntax has changed (-S option gone). See

  • REVISED 16 Jan 2017: conversion to Python 3.

  • Fixed a bit more, 2020-01-19. Also type hinting.

class List[str], dest: str | None = None, nargs: int | str = '?', default: Any | None = None, required: bool = False, type: Callable[[str], Any] | None = None, metavar: str | None = None, help: str | None = None)[source]

This provides a command-line option to provide a password or read it interactively.

Use it like this:

    '--password', type=str, action=PasswordPromptAction,
    help="MySQL password")

Modified from