If you have access to a linux box with mdbtools installed, you can use this Bash shell script (save as mdbconvert.sh):
#!/bin/bash
TABLES=$(mdb-tables -1 $1)
MUSER="root"
MPASS="yourpassword"
MDB="$2"
MYSQL=$(which mysql)
for t in $TABLES
do
$MYSQL -u $MUSER -p$MPASS $MDB -e "DROP TABLE IF EXISTS $t"
done
mdb-schema $1 mysql | $MYSQL -u $MUSER -p$MPASS $MDB
for t in $TABLES
do
mdb-export -D '%Y-%m-%d %H:%M:%S' -I mysql $1 $t | $MYSQL -u $MUSER -p$MPASS $MDB
done
I modified the script by Nicolay77 to output the database to stdout (the usual way of unix scripts) so that I could output the data to text file or pipe it to any program I want. The resulting script is a bit simpler and works well.
Some examples:
./mdb_to_mysql.sh database.mdb > data.sql
./mdb_to_mysql.sh database.mdb | mysql destination-db -u user -p
Here is the modified script (save to mdb_to_mysql.sh)
#!/bin/bash
TABLES=$(mdb-tables -1 $1)
for t in $TABLES
do
echo "DROP TABLE IF EXISTS $t;"
done
mdb-schema $1 mysql
for t in $TABLES
do
mdb-export -D '%Y-%m-%d %H:%M:%S' -I mysql $1 $t
done
OSX users can follow by Nicolay77 or mikkom that uses the mdbtools utility. You can install it via Homebrew. Just have your homebrew installed and then go
$ brew install mdbtools
Then create one of the scripts described by the guys and use it. I've used mikkom's one, converted all my mdb files into sql.