我如何让 MS EXCEL 连接到 MYSQL 数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21706314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do i get MS EXCEL to Connect to MYSQL Database
提问by Martin
How Can i get Microsoft Excel 2010 to Connect to MYSQL Server (5.6.12)
如何让 Microsoft Excel 2010 连接到 MYSQL Server (5.6.12)
I installed MYSQL as a WAMP installation
我安装了 MYSQL 作为 WAMP 安装
Windows 7 Ultimate 64bit
视窗 7 旗舰版 64 位
MYSQL 5.6.12
MYSQL 5.6.12
Apache 2.4.4
阿帕奇 2.4.4
PHP 5.4.16
PHP 5.4.16
this should be straight forward, but i've obviously missed something
这应该是直截了当的,但我显然错过了一些东西
Now.. When i open Excel 2010
现在.. 当我打开 Excel 2010
i then go to "Data"
然后我去“数据”
i then go to "From Other Sources"
然后我去“来自其他来源”
i then select "From SQL Server"
然后我选择“从 SQL Server”
I'm then presented with the Data Connection Wizard
然后我会看到数据连接向导
I have the Log on Credentials (that's not an issue)
我有登录凭据(这不是问题)
I'm Logging on with "Use the following User Name and Password"
我正在使用“使用以下用户名和密码”登录
i require the SERVER NAME
我需要服务器名称
but i keep getting this error
但我一直收到这个错误
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server 不存在或访问被拒绝
I understand the concept of what needs to happen, that being, i need to specify the connection path of MYSQL to Excel
我理解需要发生什么的概念,也就是说,我需要指定 MYSQL 到 Excel 的连接路径
Now.. so far i have done this...
现在......到目前为止我已经做到了......
Ensured that the WAMP Server was ONLINE and the Service was STARTED
obviously the default server is
localhost
that does not work, but then again on my machine that only brings up the WAMP page (so that's Understandable)i usually access MYSQL via PhpMyAdmin the URL for the Login page is
确保 WAMP 服务器在线且服务已启动
显然默认服务器
localhost
不起作用,但又在我的机器上只显示 WAMP 页面(所以这是可以理解的)我通常通过 PhpMyAdmin 访问 MYSQL,登录页面的 URL 是
http://localhost
/phpmyadmin/
http:/// localhost
phpmyadmin/
i tried entering that (that doesn't work either, but then again, i understand that is only the front end)
我尝试输入(这也不起作用,但话说回来,我明白这只是前端)
so..
所以..
- i tried typing in MYSQL , mysql , MYSQL5.6.12 , mysql/mysql5.6.12
- 我尝试输入 MYSQL 、 mysql 、 MYSQL5.6.12 、 mysql/mysql5.6.12
none of that worked
没有一个工作
- the MYSQL install path is
- MYSQL安装路径是
C:\WAMP\bin\mysql\mysql5.6.12
C:\WAMP\bin\mysql\mysql5.6.12
so.. Logically if i gave that to Excel, it should find it, But it didn't
所以......从逻辑上讲,如果我把它交给 Excel,它应该会找到它,但它没有
I researched the Net and everything Either says Use the Wizard , but doesn't go into detail on the Server Name, one place said to install Microsoft Connector, I have done so.. it didnt' help
I have tried the Server Name as
localhost
, http://localhost
, 127.0.0.1 didn't workUsing MYSQL CLI i entered "status;" and used the connection name
localhost
via TCP/IP didn't worki went into MYSQL buddy and i found this
我研究了网络和所有内容要么使用向导,但没有详细介绍服务器名称,一个地方说要安装 Microsoft 连接器,我已经这样做了..它没有帮助
我已经尝试将服务器名称设为
localhost
, http://localhost
, 127.0.0.1 没有用使用 MYSQL CLI 我输入了“状态”;并
localhost
通过 TCP/IP使用连接名称 不起作用我进入了 MYSQL 好友,我发现了这个
You are connected to MySQL 5.6.12 with the user Martin.Kuliza@localhost
.
您已通过用户 Martin.Kuliza@ 连接到 MySQL 5.6.12 localhost
。
i tried this also, didn't work
我也试过这个,没用
- i noticed the URL on the command line title as being
- 我注意到命令行标题上的 URL 是
C:\Windows\System32\cmd.exe - C:\wamp\bin\mysql\mysql5.6.12.bin\mysql.exe -u
C:\Windows\System32\cmd.exe - C:\wamp\bin\mysql\mysql5.6.12.bin\mysql.exe -u
i entered all this... didn't work
我输入了所有这些...没有用
i entered the part Starting from C:\wamp.... Didn't work
我进入了从 C:\wamp 开始的部分......没有工作
- I've tried entering wamp, WAMP, Apache, APACHE, apache
- 我试过输入 wamp、WAMP、Apache、APACHE、apache
I've tried dozens of combinations
我已经尝试了几十种组合
I've tried finding the config file for connector in case that had something to do with it (couldn't find it)
我已经尝试找到连接器的配置文件,以防与它有关(找不到)
i've tried looking at the config.inc.php file for clues,
我试过查看 config.inc.php 文件以寻找线索,
I'm stuck and need some help (for this seemingly simple problem)
我被卡住了,需要一些帮助(对于这个看似简单的问题)
it's just a Connection Wizard and i'm honestly gobsmacked that i actually need to ask the forum for help, but, Sadly i do
这只是一个连接向导,老实说,我很惊讶我实际上需要向论坛寻求帮助,但是,可悲的是我确实这样做了
采纳答案by Martin
I FOUND A SOLUTION...
我找到了一个解决方案......
Kudos to HongTAT for keeping me on the right path....
感谢 HongTAT 让我走在正确的道路上......
(Even though i did do all the initial stuff that you posted, before i actually posted the question, The Act of you Posting it, Got me Looking at it a little deeper...
(尽管我确实做了你发布的所有初始内容,但在我实际发布问题之前,你发布它的行为,让我更深入地看它......
One thing led to another and i found the solution... Thank you
一件事导致另一件事,我找到了解决方案......谢谢
i suspect some sort of incompatibility issue must have been at fault here i noticed that Power Query 64 bit would not install on my 64bit system
我怀疑这里一定是某种不兼容问题,我注意到 Power Query 64 位不会安装在我的 64 位系统上
instead Power Query installer provided an Error that simply stated to the effect of:
相反,Power Query 安装程序提供了一个错误,简单说明了以下效果:
since office is 32bit you can't install 64bit Power Query
由于 Office 是 32 位,因此您无法安装 64 位 Power Query
but, i did install Connector/ODBC and Connector/Net as 64bit
但是,我确实将 Connector/ODBC 和 Connector/Net 安装为 64 位
perhaps there was something in that configuration that didn't mesh well with each other.
也许那个配置中有一些东西不能很好地相互配合。
Also, Aparently "bit-ness" is a confusing term that is supposed to mean ( Ensure that that bit instruction set of the of the ODBC Connector Matches the bit instruction set of Power Query in Excel)
此外,显然“位”是一个令人困惑的术语,应该是指(确保 ODBC 连接器的位指令集与 Excel 中的 Power Query 的位指令集匹配)
In actual fact you don't need Power Query or Visual Studio for that matter
实际上,您不需要 Power Query 或 Visual Studio
However i can see the benefit of power Query, at this stage
但是,在此阶段,我可以看到 Power Query 的好处
WHAT I DID...
我做了什么...
I uninstalled all traces of Microsoft Visual Studio from Add/Remove Programs
我从添加/删除程序中卸载了 Microsoft Visual Studio 的所有痕迹
I Uninstalled all Traces of Visual C++ Redistributable from Add/Remove Programs
我从添加/删除程序中卸载了 Visual C++ Redistributable 的所有痕迹
I Uninstalled Power Query from Add/Remove Programs
我从添加/删除程序中卸载了 Power Query
I Uninstalled MYSQL Connector/ODBC from Add/Remove Programs
我从添加/删除程序中卸载了 MYSQL 连接器/ODBC
I Uninstalled MYSQL Connector/Net from Add/Remove Programs
我从添加/删除程序中卸载了 MYSQL Connector/Net
i left the WAMP Installation and MYSQL Intact
我离开了 WAMP 安装和 MYSQL Intact
i conducted a Windows Update
我进行了 Windows 更新
i restarted the system
我重新启动了系统
i then downloaded the following and installed it
然后我下载了以下内容并安装了它
http://dev.mysql.com/downloads/file.php?id=450946
http://dev.mysql.com/downloads/file.php?id=450946
Now.. Even though this Package installation is the same thing as installing it 1 by 1
现在.. 即使这个 Package 安装与 1 by 1 安装是一样的
i found that by doing a "CUSTOM INSTALLATION"
我发现通过“自定义安装”
and installing all products EXCEPT FOR MYSQL SERVER
并安装除 MYSQL SERVER 之外的所有产品
i was able to connect via the connector/net to the MYSQL Database right away
我能够立即通过连接器/网络连接到 MYSQL 数据库
LASTLY i installed Power Query for Excel (since that was the whole point to begin with)
最后我安装了 Power Query for Excel(因为这是开始的重点)
and this time it connected right away and Worked Perfectly
这次它立即连接并完美运行
the Server Name was localhost
服务器名称是 localhost
as i suspected
正如我怀疑的那样
and the credentials were correct as i suspected
和我怀疑的凭据是正确的
the only thing was that i had to set it up without Encryption of password
唯一的问题是我必须在没有密码加密的情况下进行设置
i got a message saying something like My Version of Office did not support encryption or something to that effect
我收到一条消息,说我的 Office 版本不支持加密或类似的内容
but, i connected without encryption and it worked perfectly
但是,我在没有加密的情况下连接,它运行良好
PROBLEM SOLVED
问题解决了
I NOW DEEM THIS QUESTION TO BE RESOLVED
我现在认为这个问题有待解决
THANKYOU TO HongTat
感谢鸿达
回答by Tan Hong Tat
Have you done this?
你这样做了吗?
http://office.microsoft.com/en-001/excel-help/connect-to-a-mysql-database-HA104019820.aspx
http://office.microsoft.com/en-001/excel-help/connect-to-a-mysql-database-HA104019820.aspx
Before you can connect to a MySQL database, you need the MySQL Connector on your computer. To install the MySQL Connector (Connector/Net), go to http://go.microsoft.com/fwlink/?LinkId=278885and download Connector/Net 6.6.5 for Microsoft Windows. The driver bit-ness needs to match the Microsoft Power Query for Excel add-in installation (32-bit or 64-bit).
在您可以连接到 MySQL 数据库之前,您需要在您的计算机上安装 MySQL 连接器。要安装 MySQL 连接器 (Connector/Net),请访问http://go.microsoft.com/fwlink/?LinkId=278885并下载适用于 Microsoft Windows 的 Connector/Net 6.6.5。驱动程序位数需要与 Microsoft Power Query for Excel 加载项安装(32 位或 64 位)相匹配。
回答by Jeff
Did you try googling this before you posted your question? Because if you spent at least 10 seconds searching the internet, you would have found the answer to your question.
在发布问题之前,您是否尝试过谷歌搜索?因为如果您至少花 10 秒钟在互联网上搜索,您就会找到问题的答案。
http://office.microsoft.com/en-us/excel-help/connect-to-a-mysql-database-HA104019820.aspx
http://office.microsoft.com/en-us/excel-help/connect-to-a-mysql-database-HA104019820.aspx