将mysql数据库导出到Microsoft Access(.mdb)

I'm looking for some tips on how to export a mysql database into a .mdb file that is readable by Microsoft Access 2007+ (and editable too!). It needs to be a script that can run on a Linux server (maybe using PHP?).

I can't seem to find out anything anywhere. Any ideas?

Cheers!

You could create a a CSV file from MySql and then import that into Access. You can use OLEDB or ODBC connection to access and should be able to do the inserts that way.

Are you also trying to create the mdb file on the fly? I'm assuming that you have one built already and just want to export the data from mysql and import into access.

I have not tried this.

The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms. This is to include GUI support for both KDE and GNOME.

-- http://www.unixodbc.org/

Thanks for your tips :)

I have since found out we're already using this product elsewhere: http://dbconvert.com/convert-access-to-mysql-pro.php?DB=1 It's running under Wine on our server, although I don't think it supports the latest versions of Access.

  1. Install the ODBC driver from MySQL.
  2. Create the ODBC system DSN entry.
  3. On Access, execute a query like this:

SELECT * INTO AccessTable FROM [ODBC;DATABASE=Database_Name;DSN=DSN_Name;OPTION=2059;PWD=MySQL_Password;PORT=0;UID=MySQL_User].MySQLTable

(Replace accordingly: AccessTable, MySQLTable, Database_Name, DSN_Name, MySQL_Password, MySQL_User)