MySQL 在端口 3306 上运行的另一个 mysqld 服务器错误

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

Another mysqld server running on port 3306 error

mysqlinstallation

提问by Shaan

I have installed Mysql 5.1 on Mac OS X 10.7 Lion. For some reason, though, when I try starting the server with the command "mysqld" I get an error in the log file which says:

我已经在 Mac OS X 10.7 Lion 上安装了 Mysql 5.1。但是,出于某种原因,当我尝试使用命令“mysqld”启动服务器时,我在日志文件中收到一条错误消息:

120328 21:32:40 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use

120328 21:32:40 [错误] 无法启动服务器:绑定在 TCP/IP 端口上:地址已在使用中

120328 21:32:40 [ERROR] Do you already have another mysqld server running on port: 3306 ?

120328 21:32:40 [ERROR] 您是否已经在端口 3306 上运行了另一个 mysqld 服务器?

120328 21:32:40 [ERROR] Aborting

120328 21:32:40 [错误] 中止

If I run "netstat -nat | grep 3306" in my terminal, I get the following:
tcp4 0 0 *.3306 .LISTEN

如果我在终端中运行“netstat -nat | grep 3306”,我会得到以下信息:
tcp4 0 0 *.3306

UPDATE:

更新:

So here's the output for that.
mysqld 24645 sb1752 12u IPv4 0xffffff8010f6bde0 0t0 TCP *:mysql (LISTEN)

所以这是它的输出。
mysqld 24645 sb1752 12u IPv4 0xffffff8010f6bde0 0t0 TCP *:mysql (听)

This is odd though! Because my mysql server is not started.
When I type "mysql" in command line, it says
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

虽然这很奇怪!因为我的mysql服务器没有启动。
当我在命令行中输入“mysql”时,它显示
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I did install other version of mysql and uninstalled earlier today. Any idea what to do here?

我确实安装了其他版本的 mysql,今天早些时候卸载了。知道在这里做什么吗?

采纳答案by stewe

You could use netstat -lp | grep 3306to find out what program is already listening on port 3306 (you should see PID/Program name in last column) and stop that (maybe mysql is already running?).

您可以使用netstat -lp | grep 3306来找出哪个程序已经在端口 3306 上侦听(您应该在最后一列中看到 PID/程序名称)并停止它(也许 mysql 已经在运行?)。

Alternatively you could start the newly installed server on a different port. (edit my.cnfand change the default port there)

或者,您可以在不同的端口上启动新安装的服务器。(my.cnf在那里编辑和更改默认端口)

回答by dhchen

use lsof -i TCP:3306to check which program binds port 3306

用于lsof -i TCP:3306检查哪个程序绑定了3306端口