无法连接到“localhost”上的 MySQL 服务器 (10061)
我最近在 Windows 2003 上安装了 MySQL 5 并尝试配置实例。 一切工作正常,直到我进入“应用安全设置”,此时它给了我上述错误(无法连接到'localhost'(10061)上的MySQL服务器
)。
我的防火墙中确实有“MySQL 服务器”的端口 3306 例外。
I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to "Applying Security settings", at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)
).
I do have a port 3306 exception in my firewall for 'MySQL Server'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(19)
在 Windows 上出现此错误是因为我的 mysqld.exe 没有运行。
从命令行运行 "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install 将其添加到我的服务中,运行 services.msc (开始 -> 运行) ,找到MySQL服务并启动它。
从此以后就不用再担心了。
Got this error on Windows because my mysqld.exe wasn't running.
Ran "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it.
Didn't have to worry about it from there on out.
要解决此问题:
,仅此而已。
To resolve this problem:
That's all.
您可能必须向用户授予表上的“localhost”权限。 请参阅
'GRANT'
语法文档。 这是一个例子(来自一些 C 源代码)。这是 MySQL 最常见的访问问题。
除此之外,您可以检查您定义的用于创建实例的用户是否具有完全权限,否则该用户无法授予权限。
另外,请确保 mysql 服务已启动。
确保您没有打开第三方防火墙或互联网安全服务。
除此之外,MySQL 论坛上还有几个页面专门讨论此问题:
http://forums.mysql.com/read.php?11 ,9293,9609#msg-9609
尝试阅读一下。
You'll probably have to grant 'localhost' privileges to on the table to the user. See the
'GRANT'
syntax documentation. Here's an example (from some C source).That's the most common access problem with MySQL.
Other than that, you might check that the user you have defined to create your instance has full privileges, else the user cannot grant privileges.
Also, make sure the mysql service is started.
Make sure you don't have a third party firewall or Internet security service turned on.
Beyond that, there's several pages of the MySQL forum devoted to this:
http://forums.mysql.com/read.php?11,9293,9609#msg-9609
Try reading that.
英语:
Français :
English:
Français :
我在通过标准端口 3306 上的本地主机连接进行连接时访问 MySQL 时遇到了困难,当我为之前在 MySQL 和 Java 中学习的课程安装和配置它时,它工作得很好。 我收到诸如“错误 2003”和“无法连接到本地主机上的 MySql 服务器(10061)”之类的错误。 我尝试从 MySQL Workbench (5.2.35 CE) 和 Netbeans (7.2) 进行连接。 我使用的是 Windows 7 64 位专业版。
我尝试在开始菜单搜索框中输入services.msc,这会打开服务对话框以显示Windows中安装的所有服务。 我向下滚动到 MySQL 并启动了该服务。 随后尝试从 MySQL WorkBench 和命令提示符连接到 MySQL 成功。
I had difficulty accessing MySQL while connecting via a localhost connection on the standard port 3306, which worked fine when I installed and configured it for prior classes I had taken in MySQL and Java. I was getting errors like "error 2003" and "Cannot connect to MySql server on localhost (10061)". I tried connecting from both MySQL Workbench (5.2.35 CE) and Netbeans (7.2). I am using Windows 7 64 bit professional.
I tried typing in services.msc in the start menu search box, which opened the services dialog box to show all the services installed in windows. I scrolled down to MySQL and started this service. Subsequent attempts to connect to MySQL from MySQL WorkBench and from the command prompt succeeded.
按 Windows 键 + R
写入“services.msc”回车
搜索“MYSQL56”
写入点击它并启动服务
press Windows key + R
write "services.msc" enter
search for "MYSQL56"
write click on it and start the service
确保您的 Windows 主机文件(位于
c://windows/system32/drivers/etc.host
)具有以下行。 如果没有,请在最后添加<前><代码>127.0.0.1 本地主机
::1 本地主机
有时如果防火墙阻止,mysql 无法触发 Windows 强制启动主机服务,因此需要手动启动
win+run>>services.msc,选择“MySQL_xx”,其中“xx”是您在运行期间分配给MySQL主机服务的名称设置。 单击“开始”从左侧出现的超链接开始。
Make sure that your windows host file (located at
c://windows/system32/drivers/etc.host
) has following line. If not, add it at the endSometimes mysql can not trigger Windows to force start host services if firewall blocks it, so start it manually
win+run>>services.msc, select the "MySQL_xx" where "xx" is the name you have assigned to MySQL host services during setup. Click on 'start' to start from hyperlink appeared on left side.
我尝试了 Kuzhichamadam Inn 的解决方案,发现需要做一些小小的改变。
MYSQL57 是一个网络服务。 我曾多次尝试过这一点,但没有成功。 当我打开 services.msc 时,我发现了 localhost 的另一个服务:MySQL。 我使用下面的流程开始了这一过程,并且成功了。
运行> 服务.msc > 右键单击 MySQL > 属性>开始
I tried Kuzhichamadam Inn's solution and found that a slight change needed to be made.
MYSQL57 was a network service. I had tried this repeatedly with no success. When I opened services.msc I found another service for localhost: MySQL. I started that one using the process below and it worked.
run > services.msc > rightclick MySQL > properties >start
当我的驱动器空间不足时,我收到此错误。
I got this error when I ran out of space on my drive.
转到运行,输入
services.msc。
检查MySQL服务是否正在运行。 如果没有,请手动启动。 启动后,输入MySQL Show
来测试该服务。Go to Run type
services.msc.
Check whether or not MySQL services are running. If not, start it manually. Once it is started, typeMySQL Show
to test the service.要本地连接到
MySql
,您不必设置具有入站规则的防火墙。 但是,即使您已经设置 iptables 来允许 TCP 入站端口 3306 并授予用户本地访问数据库的权限,您可能还需要设置绑定地址在my.cnf
文件中,编辑默认地址并输入运行MySql
服务的服务器 IP 地址。To connect locally to
MySql
, you do not have to setup a firewall with inbound rules. But, even if you already setupiptables
to allow theTCP
inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in yourmy.cnf
file, edit the default address there and put the server IP address that is running theMySql
service.由于我一直在努力并在这里找到了一个略有不同的答案,所以它是:
我最近在新工作场所切换了本地(内联网)服务器。 安装了灯; Debian、Apache、MySql、PHP。 工作中的用户使用主机名连接服务器,我们称之为“intaserv”。 我设置了一切,让它工作,但无论我做什么都无法远程连接我的 MySql。
经过无数次的尝试,我找到了答案。 您只能有一个绑定地址,并且它不能是主机名,在我的例子中是“Intranet”。
它必须是一个 IP 地址,例如。 “绑定地址=192.168.0.50”。
Since I have struggled and found a slightly different answer here it is:
I recently switched the local (intranet) server at my new workplace. Installed a LAMP; Debian, Apache, MySql, PHP. The users at work connect the server by using the hostname, lets call it "intaserv". I set up everything, got it working but could not connect my MySql remotely whatever I did.
I found my answer after endless tries though. You can only have one bind-address and it cannot be hostname, in my case "intranet".
It has to be an IP-address in eg. "bind-address=192.168.0.50".
重新启动计算机后,
在 cmd 中,
它将变为
类型
mysql -u root -p
,即
C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u root -p
输入密码:
****
这就是全部
结果
after restarting computer
At cmd
it will become
type
mysql -u root -p
ie
C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u root -p
Enter password:
****
That's all
It will result in
另一种可能性:
MySQL 客户端有两种方式连接到服务器:通过 TCP/IP 或使用套接字。 您可能将 MySQL 服务器配置为支持套接字连接,但不支持网络连接。
Another possibility:
There are two ways the MySQL client can connect to the server: over TCP/IP, or using sockets. It's possible you have your MySQL server configured to support socket connections, but not network connections.
无需执行任何操作,只需将防火墙设置“重置为默认值”即可开始工作。
我阅读了很多解决方案,但没有一个能正常工作,所以最后我重置了有效的防火墙设置。
Nothing to do just "Reset to Default" your firewall setting it will start working.
I read many solutions but nothing worked properly, so at last I reset firewall settings which worked.
终于解决了这个问题..尝试在xammp中运行mysql。 xammp 中 mysql 的复选框应取消选中。 然后启动它。 之后你现在可以打开 mysql,它现在将连接到本地主机
finally solved this.. try running mysql in xammp. The check box of mysql in xammp should be unclicked. then start it. after that you can open now mysql and it will now connect to the localhost
编辑您的“my-default.ini”文件(默认情况下它带有注释属性),如下所示。
有一篇非常好的文章规定了创建用户、浏览表等的命令。
http://www.ntu.edu.sg /home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
Edit your 'my-default.ini' file (by default it comes with commented properties)as below ie.
There is very good article present that dictates commands to create user, browse tables etc ie.
http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
我没有安装 Mysql 服务器,该包丢失了,我从这个链接 https:// dev.mysql.com/downloads/installer/
I did not have Mysql server installed, that package was missing and I got it from this link https://dev.mysql.com/downloads/installer/