无法连接到“localhost”上的 MySQL 服务器 (10061)

发布于 2024-07-06 02:23:00 字数 172 浏览 10 评论 0原文

我最近在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

空城旧梦 2024-07-13 02:23:00

在 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.

哆啦不做梦 2024-07-13 02:23:00

要解决此问题:

  1. 转到任务管理器,
  2. 选择“服务”选项卡,
  3. MySql 服务
  4. 找到“正在运行”的

,仅此而已。

To resolve this problem:

  1. go to the task manager
  2. select Services tab
  3. find MySql service
  4. Running

That's all.

月牙弯弯 2024-07-13 02:23:00

您可能必须向用户授予表上的“localhost”权限。 请参阅 'GRANT' 语法文档。 这是一个例子(来自一些 C 源代码)。

“将 %s.* 上的所有权限授予由“%s”标识的“%s”@“localhost””;

这是 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).

"GRANT ALL PRIVILEGES ON %s.* TO '%s'@'localhost' IDENTIFIED BY '%s'";

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.

你是我的挚爱i 2024-07-13 02:23:00

英语:

  • Windows + R
  • 写入“services.msc”。 然后按 Enter
  • 搜索 MySQL57 并右键
  • 单击启动服务

Français :

  • Appuyez sur la touche Windows + R
  • Écrire "services.msc"请先安装
  • MySQL57,然后再使用
  • Cliquez sur rédémarrer

English:

  • press Windows + R
  • write "services.msc". Then press Enter
  • search for MySQL57 and right click
  • click on start the service

Français :

  • Appuyez sur la touche Windows + R
  • Écrire "services.msc" Puis appuyez sur Entrée
  • Recherchez MySQL57 et clic droit
  • Cliquez sur rédémarrer
那请放手 2024-07-13 02:23:00

我在通过标准端口 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.

傲影 2024-07-13 02:23:00

Windows 键 + R
写入“services.msc”回车
搜索“MYSQL56”
写入点击它并启动服务

press Windows key + R
write "services.msc" enter
search for "MYSQL56"
write click on it and start the service

抹茶夏天i‖ 2024-07-13 02:23:00
  1. 确保您的 Windows 主机文件(位于 c://windows/system32/drivers/etc.host)具有以下行。 如果没有,请在最后添加

    <前><代码>127.0.0.1 本地主机
    ::1 本地主机

  2. 有时如果防火墙阻止,mysql 无法触发 Windows 强制启动主机服务,因此需要手动启动

win+run>>services.msc,选择“MySQL_xx”,其中“xx”是您在运行期间分配给MySQL主机服务的名称设置。 单击“开始”从左侧出现的超链接开始。

  1. Make sure that your windows host file (located at c://windows/system32/drivers/etc.host) has following line. If not, add it at the end

    127.0.0.1 localhost
    ::1 localhost
    
  2. Sometimes 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.

橘香 2024-07-13 02:23:00

我尝试了 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

纸伞微斜 2024-07-13 02:23:00

当我的驱动器空间不足时,我收到此错误。

I got this error when I ran out of space on my drive.

挖鼻大婶 2024-07-13 02:23:00

转到运行,输入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, type MySQL Show to test the service.

星軌x 2024-07-13 02:23:00

要本地连接到 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 setup iptables to allow the TCP inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in your my.cnf file, edit the default address there and put the server IP address that is running the MySql service.

皇甫轩 2024-07-13 02:23:00

由于我一直在努力并在这里找到了一个略有不同的答案,所以它是:

我最近在新工作场所切换了本地(内联网)服务器。 安装了灯; 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".

你又不是我 2024-07-13 02:23:00
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic

重新启动计算机后,

在 cmd 中,

cd: C:\

C :\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"

它将变为

C:\Program Files\MySQL\MySQL Server 5.7\bin>

类型 mysql -u root -p

C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u root -p

输入密码:****

这就是全部

结果

mysql>
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic

after restarting computer

At cmd

cd: C:\

C :\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"

it will become

C:\Program Files\MySQL\MySQL Server 5.7\bin>

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>
长不大的小祸害 2024-07-13 02:23:00

另一种可能性:

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.

等数载,海棠开 2024-07-13 02:23:00

无需执行任何操作,只需将防火墙设置“重置为默认值”即可开始工作。

我阅读了很多解决方案,但没有一个能正常工作,所以最后我重置了有效的防火墙设置。

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.

划一舟意中人 2024-07-13 02:23:00

终于解决了这个问题..尝试在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

风月客 2024-07-13 02:23:00

编辑您的“my-default.ini”文件(默认情况下它带有注释属性),如下所示。

basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888

有一篇非常好的文章规定了创建用户、浏览表等的命令。

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.

basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888

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

蓬勃野心 2024-07-13 02:23:00

我没有安装 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/

少年亿悲伤 2024-07-13 02:23:00
  1. 右键单击我的电脑
  2. 单击管理
  3. 转到服务和应用程序
  4. 选择服务并找到 MySQL 服务
  5. 右键单击​​ MySQL 并选择启动
  1. Right click on My Computer
  2. Click on Manage
  3. Go to Services and Application
  4. Select Services and find MySQL service
  5. Right click on MySQL and select Start
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文