无法让 mysqldump 连接到本地 mysql 实例(错误 2003 / 10061)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5426856/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:17:34  来源:igfitidea点击:

Can't get mysqldump to connect to local mysql instance (error 2003 / 10061)

mysqlmysqldumpmysql-error-2003

提问by user291701

I've got mysql 5.1 on a windows xp machine. It's listening on port 3308. I'm trying to use mysqldump:

我在 Windows XP 机器上安装了 mysql 5.1。它正在侦听端口 3308。我正在尝试使用 mysqldump:

> mysqldump -u root -pmypassword dbname > out.sql

Getting an error:

得到一个错误:

mysqldump: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect

Not sure what the problem is, looking at --help dumps variables and shows port=3308 as I set in the mysql installation (instead of default 3306). I don't think there's anything different with my installation. I also tried explicitly setting the port # on the command line but still same error.

不确定问题是什么,查看 --help 转储变量并显示端口 = 3308,正如我在 mysql 安装中设置的那样(而不是默认的 3306)。我不认为我的安装有什么不同。我还尝试在命令行上显式设置端口 # 但仍然出现相同的错误。

Thanks

谢谢

回答by ypercube??

To connect through a port (and not the default 3306), use:

要通过端口(而不是默认的 3306)连接,请使用:

mysqldump -u root -pmypassword -P 3308 dbname > out.sql

Besides that, a simple test to see if MySQL responds at port 3308 is to try telneting:

除此之外,查看 MySQL 是否在端口 3308 响应的简单测试是尝试 telneting:

telnet 127.0.0.1 3308

If MySQL is listening on port 3308, it'll respond with an error and the version running.

如果 MySQL 正在侦听端口 3308,它将以错误和正在运行的版本进行响应。

回答by user2144100

Go to run type services.msc

转到运行类型 services.msc

then locate mysql service and start it .this solved

然后找到mysql服务并启动它。这解决了

回答by Anonymous

If your Mysql-Client is 5.5.16 please upgrade it to 5.6.10, this process worked for me if your mysql server is 5.6.10.

如果您的 Mysql-Client 是 5.5.16,请将其升级到 5.6.10,如果您的 mysql 服务器是 5.6.10,则此过程对我有用。