将MySQL数据导入Excel 365 [英] Import MySQL data to Excel 365
问题描述
我正在尝试将数据从MySQL数据库导入Excel 365(32位)工作簿.
I'm trying to import data from a MySQL Database to an Excel 365 (32 bit) Workbook.
这是我可以链接到的数据库,没有任何问题:
This is a DB I can link to without any issues :
这是我无法链接到的数据库:
This is the DB I can't link to :
我已经下载了以下连接器:
MySQL Connector Net 6.10.6
I've downloaded the following connector :
MySQL Connector Net 6.10.6
我怀疑这不是第二个DB的正确连接器. 错误是这样的:
I suspect that this is not the correct connector for the second DB. The error is this :
[MySQL: Unable to connect to any of the specified MySQL hosts.]
有人能指出我解决方案的开始吗?
Could someone point me to the beginning of a solution ?
我也尝试过通过VBA进行连接,但是我也收到了一个错误,该错误必须是由于与上述相同的原因所致.
I've also tried to connect via VBA but I also get an error which must be due to the same causes as above.
推荐答案
如果数据库服务器和数据库客户端(Excel)在不同的计算机上运行,则它们将无法通过UNIX文件系统套接字进行通信.
If the database server and the database client (Excel) are running on different machines then they cannot communicate via UNIX filesystem sockets.
如果在libmysql客户端中将localhost
指定为目标主机,则该客户端将尝试通过(Unix)文件系统套接字进行连接.
If you specify localhost
as the target host in a libmysql client, then the client will try to connect via the (Unix) filesystem socket.
反之,如果您指定127.0.0.1
,它将使用TCP套接字.
On the other hand, if you instead specify 127.0.0.1
, it will use a TCP socket.
-
堆栈溢出:当服务器位于Unix套接字中时如何连接数据库?(MySQL/PHP)
Stack Overflow : How to connect to database when server is in Unix socket? (MySQL/PHP)
维基百科: Localhost
Wikipedia: Localhost
维基百科: Unix域套接字
维基百科: TCP套接字定义
MySQL.com:使用ODBC数据源管理员GUI在Windows上配置连接器/ODBC DSN
MySQL.com : Configuring a Connector/ODBC DSN on Windows with the ODBC Data Source Administrator GUI
根据您的评论,目标主机将在这些步骤.
In response to your comment, the target host would be specified in the location specified on this page, or it can also be installed via command line with these steps.
另外,您可能会发现有帮助:
-
mysql.com: mysql.com:
mysql.com : Using Connector/ODBC with Microsoft Access
我对上次将ODBC DSN设置为MySQL的印象很淡.
I have a faint recollection of the last time I setup an ODBC DSN to MySQL.
前一段时间,所以我可能会在细节上弄错了,但是我很确定,唯一的办法就是我能够在64位系统上运行它(可能是因为服务器是32位的?)是要安装32位和64位驱动程序(来自
It was a while ago so I might be mistaken on the details but I'm pretty sure that the only was I was able to get it working on a 64-bit system (possibly because the server was 32-bit?) was to install both the 32-bit and 64-bit drivers (from here) into separate folders, rebooting between each install. As I recall, it took a dozen install/uninstalls before I got it right.
正确安装后,我必须使用Window的 32位版本的ODBC Administrator 对其进行管理.
Once it was properly installed, I had to administer it with Window's 32-bit version of ODBC Administrator.
有2个版本的ODBC管理器(又名数据源"),令人困惑:
There's 2 versions of ODBC Administrator (aka 'Data Sources'), confusingly:
-
我的64位版本位于:
c:\windows\system32\odbcad32.exe
我的32位版本位于:
c:\windows\SysWOW64\odbcad32.exe
My 32-bit version is located at :
c:\windows\SysWOW64\odbcad32.exe
请注意,其中大部分是来自内存的 和未经验证的!
Note that much of this is from memory and unverified!
我将这个文本文件放在"mySQL Notes"文件夹中,所以我收集了 我最终使用命令行进行了安装:
I have this text file sitting in my "mySQL Notes" folder, so I gather I ended up using the command line to get it installed:
myodbc-installer -s -a -c1 -n "
mysqlDSN
" -t "DRIVER=MySQL ODBC 5.3 Unicode Driver;SERVER=
(server name)
;DATABASE=
(database name)
;UID=
(user name)
;PWD=
(password)
"
myodbc-installer -s -a -c1 -n "
mysqlDSN
" -t "DRIVER=MySQL ODBC 5.3 Unicode Driver;SERVER=
(server name)
;DATABASE=
(database name)
;UID=
(user name)
;PWD=
(password)
"
在我的情况下,我正在建立与Web主机服务器的连接,因此我将
server
/database
/uid
值参考了我的CPanel.In my case I was setting up connection to a web host server, so I referred to my CPanel for the
server
/database
/uid
values....而且我记得,我必须从
myodbc-installer
的32-但版本的位置运行它.另外,您将在某处显示ODBC.INI
文本文件以显示配置....and as I recall, I had to run it from the location of the 32-but version of the
myodbc-installer
. Also, you'll have anODBC.INI
text file somewhere showing the configuration.更多详细信息,位于此处的大量信息下:
More detail under the plethora of information here:
- mysql.com: MySQL连接器/ODBC开发人员指南
这篇关于将MySQL数据导入Excel 365的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-