Created
October 21, 2015 21:35
-
-
Save burningTyger/31dfdb67afbc4f68ec2f to your computer and use it in GitHub Desktop.
Revisions
-
burningTyger created this gist
Oct 21, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/bash # found this here: http://stackoverflow.com/questions/5722544/how-can-i-convert-an-mdb-access-file-to-mysql-or-plain-sql-file # # Create DB like this: CREATE DATABASE xyc; # To invoke it simply call it like this: # ./mdbconvert.sh accessfile.mdb mysqldatabasename 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