Skip to content

Instantly share code, notes, and snippets.

@lentschi
Created June 7, 2016 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lentschi/c960e9d23cc17019373bc2b9eb0e8141 to your computer and use it in GitHub Desktop.
Save lentschi/c960e9d23cc17019373bc2b9eb0e8141 to your computer and use it in GitHub Desktop.
Dumps schema and data of a Microsoft Access database file to mysql (REQUIRES mdbtools!)
#!/bin/bash
# Dumps schema and data of mdbfile (which can be .accdb too) to mysql
if [ $# -ne 2 ]; then
echo usage: $0 mdbfile mysqlfile
exit 1
fi
mdb-schema $1 mysql > $2
for i in $( mdb-tables $1 )
do
mdb-export -D "%Y-%m-%d %H:%M:%S" -H -I mysql $1 $i >> $2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment