How can I convert an MDB (Access) file to MySQL (o

2019-01-29 17:30发布

Is it possible to create a Dump of SQL commands from a Microsoft Access database? I hope to convert this MDB file into a MySQL database for importing so I don't have to go through the CSV step.

I would expect even an MSSQL dump file to still contain workable SQL commands, but I know nothing of MSSQL, please let me know.

12条回答
我只想做你的唯一
2楼-- · 2019-01-29 17:55
淡お忘
3楼-- · 2019-01-29 17:55

If you are not too concerned with the privacy of the .mdb files you want to convert, please know that this site allowed me to recover two 15-years-old .mdb Access databases (remember the old times when ASP ruled the web?) in just two minutes : http://www.mdbopener.com/

The databases were converted in Excel files, with one sheet for each table. Just what I needed. Couldn't have been any faster to recover my (very) old data...

The IDs being kept in each table, it was as easy as anything to convert this again to mysql (after saving it to CSV format) - again, in just a few minutes.

查看更多
Luminary・发光体
4楼-- · 2019-01-29 17:56

Free database tools don't export table RELATIONSHIPS, but you can use this: converting MS Access to MySQL with relationships

Works fine and export all relationships to MySQL.

enter image description here

查看更多
做个烂人
5楼-- · 2019-01-29 17:57

We've used ESF Database Convert many times for this exact purpose. DTS was usually too flakey. And the recommendations on the MySQL page were woefully out of date.

查看更多
聊天终结者
6楼-- · 2019-01-29 18:07

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

To invoke it simply call it like this:

./mdbconvert.sh accessfile.mdb mysqldatabasename

It will import all tables and all data.

查看更多
成全新的幸福
7楼-- · 2019-01-29 18:10

You want to convert mdb to mysql (direct transfer to mysql or mysql dump)?

Try a software called Access to MySQL.

Access to MySQL is a small program that will convert Microsoft Access Databases to MySQL.

  • Wizard interface.
  • Transfer data directly from one server to another.
  • Create a dump file.
  • Select tables to transfer.
  • Select fields to transfer.
  • Transfer password protected databases.
  • Supports both shared security and user-level security.
  • Optional transfer of indexes.
  • Optional transfer of records.
  • Optional transfer of default values in field definitions.
  • Identifies and transfers auto number field types.
  • Command line interface.
  • Easy install, uninstall and upgrade.

See the aforementioned link for a step-by-step tutorial with screenshots.

查看更多
登录 后发表回答