← 返回命令列表

Linux command

mdbtools 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List the tables

mdb-tables [database.mdb]

Export a table

mdb-export [database.mdb] [tablename]

Dump the entire schema

mdb-schema [database.mdb]

Count rows

mdb-count [database.mdb] [tablename]

Open an interactive SQL

mdb-sql [database.mdb]

Dump every table

for t in $(mdb-tables -1 [database.mdb]); do mdb-export [database.mdb] "$t" > "$t.csv"; done

Convert to a SQLite database

mdb-schema [database.mdb] sqlite | sqlite3 [out.db] && for t in $(mdb-tables -1 [database.mdb]); do mdb-export -I sqlite [database.mdb] "$t" | sqlite3 [out.db]; done

说明

mdbtools is a suite of utilities for reading Microsoft Access databases on Unix-like systems without requiring the Microsoft Jet or ACE engine. Each tool is a separate binary that operates on a single .mdb or .accdb file: mdb-tables lists tables, mdb-schema prints DDL, mdb-export dumps rows, mdb-sql runs queries, mdb-count counts rows, mdb-prop lists object properties, and mdb-ver shows the Access version stored in the file. Typical workflows are migration (export every table to CSV or to another RDBMS using -I _backend_) and inspection (running SELECTs from mdb-sql). The suite also ships a libmdb library that GUI tools and the mdb-export ODBC driver use under the hood.

参数

mdb-tables -1
List tables; -1 prints one name per line for shell iteration.
mdb-schema _backend_
Dump SQL CREATE statements; backend selects dialect (access, sybase, oracle, sqlite, postgres, mysql).
mdb-export -I _backend_ -d _delim_ -q _quote_
Export a single table. -I emits INSERT statements for the given backend; otherwise CSV.
mdb-sql
Open an interactive SQL prompt supporting a subset of SQL92.
mdb-count
Print the number of rows in a table.

FAQ

What is the mdbtools command used for?

mdbtools is a suite of utilities for reading Microsoft Access databases on Unix-like systems without requiring the Microsoft Jet or ACE engine. Each tool is a separate binary that operates on a single .mdb or .accdb file: mdb-tables lists tables, mdb-schema prints DDL, mdb-export dumps rows, mdb-sql runs queries, mdb-count counts rows, mdb-prop lists object properties, and mdb-ver shows the Access version stored in the file. Typical workflows are migration (export every table to CSV or to another RDBMS using -I _backend_) and inspection (running SELECTs from mdb-sql). The suite also ships a libmdb library that GUI tools and the mdb-export ODBC driver use under the hood.

How do I run a basic mdbtools example?

Run `mdb-tables [database.mdb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does mdb-tables -1 do in mdbtools?

List tables; -1 prints one name per line for shell iteration.