IT, Startup and Innovation

Convert a MDB file to SQL file

Reading Time: < 1
Explore the use of MDB file extension, a format to save Microsoft Access files, and learn how to convert .mdb to .sql using docker.
mdb to sql conversion

Table of Contents

What is mdb file extension

Mdb file extension is a format use to save Microsoft Access files. They can be seen as an equivalent of sqlite in the sense where they store all informations for the access database.

How to convert .mdb to .sql

After trying multiple method, I end up using a docker image which include the mdb tools library. It’s a set of tools allowing you to work with Microsoft Access files. You can find the image repository, I used here

I use the following bash script named



docker run -it --rm -v "$PWD":/opt/mdbdata rillke/mdbtools bash -c " /opt/mdbdata/${FILE_IN}" > ${FILE_OUT}

sed -i -e "s/\r//g" ${FILE_OUT}
sed -i '/^--/ d' ${FILE_OUT}
sed -i '/ ();$/ d' ${FILE_OUT}
sed -i '/^ERROR/ d' ${FILE_OUT}
sed -i '/^Error/ d' ${FILE_OUT}
sed -i '/^CRITICAL/ d' ${FILE_OUT}
sed -i '/ALTER TABLE .* ADD INDEX .*;/ d' ${FILE_OUT}
sed -i '/DROP TABLE IF EXISTS to;/ d' ${FILE_OUT}
sed -i '/DROP TABLE IF EXISTS delete;/ d' ${FILE_OUT}
sed -i '/DROP TABLE IF EXISTS Table;/ d' ${FILE_OUT}
sed -i '/DROP TABLE IF EXISTS des;/ d' ${FILE_OUT}
sed -i '/DROP TABLE IF EXISTS erreurs;/ d' ${FILE_OUT}


The command to use this script is :

 input.mdb output.sql

Share it on:


About the Author

Gary Gitton
Hello, I'm Gary Gitton - an accomplished Software Engineer, Tech Lead, specializing in PHP, API Engineering, DevOps, and Cloud Management. Throughout my career, I've had the privilege to enhance multiple software solutions with my expertise in multiple languages and platforms. I bring my unique blend of technical and business acumen to every project, ensuring efficient, scalable, and innovative outcomes. I'm also passionate about fostering a culture of continuous learning, mentoring developers, and leading projects with agile methodologies. Whether concocting a bespoke API or orchestrating cloud environments, I'm committed to delivering quality and excellence. Let's connect and transform your vision into a digital reality.

You might also like