如果与Access相比,Excel连接MySQL真麻烦。没办法,谁让谁让?MySQL不是MicroSoft的产品,而MySQL应用如此广泛。以下是查阅网上资料和实际操作后总结出的几种使用方法。
操作环境:
操作系统:Windows 7 SP1 专业版 64位
Excel版本:Excel 2010
方法一:MySQL推出的Excel连接工具
工具名称:MySQL for Excel
官方介绍:
MySQL for Excel is an Excel Add-In that is installed and accessed from within Microsoft Excel’s Data tab, offering a wizard-like interface to help users browse MySQL Schemas, Tables, Views and Procedures and perform data operations. MySQL for Excel supports:Import Data,Export Data,Append Data,Edit Data.
安装完成后,在Excel在数据选项卡的最右侧,将有数据选项卡MySQL for Excel图标(见下图)。
方法二:ODBC
首先需要安装Connector/ODBC(MySQL驱动)。
Connector/ODBC官方介绍:Connector/ODBC is a standardized database driver for Windows, Linux, Mac OS X, and Unix platforms.
特别注意区分32位和64位!比如,虽然我的Windows 7系统是64位,但是MySQL如果安装32位,则应安装驱动器mysql-connector-odbc-5.3.9-win32.msi”。如果安装不当,会弹出[Microsoft][ODBC 驱动程序管理器] 在指定的 DSN 驱动程序与应用程序之间的系统结构不匹配的错误提示。
此外,32位和64位驱动的具体使用方法也不同。控制面板ODBC数据源管理器只能看到64位驱动器,看不到32位驱动器。使用32位驱动器,需要c:\windows\syswow64\文件夹下找odbcad32.exe双击后,可根据窗口提示操作此程序。
方法三:Microsoft Power Query for Excel
官方介绍:Microsoft Power Query for Excel is an Excel add-in that enhances the self-service Business Intelligence experience in Excel by simplifying data discovery, access and collaboration.
参考资料:
1、Excel连接MySQL
2、MySQL for Excel
3.安装卸载MySQL的详细步骤
4、Power Query
4、ADO