MySQL启动报错“Bind on TCP/IP port: Address already in use”

启动报错“Bind on TCP/IP port: Address already in use”

问题描述:
mysql启动失败,查看err日志
# tail -f /database/umc/data/umc.err
141106 10:37:14 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
141106 10:37:14 [ERROR] Do you already have another mysqld server running on port: 3306 ?

原因分析:

端口3306被占用

使用命令:
ps -aux | grep mysql
发现并没有3306端口的mysql进程。

使用命令:netstat –apn 
查看所有的进程和端口使用情况。发现下面的进程列表,其中最后一栏是PID/Program name 
# netstat -apn  | grep 3306    
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:3306  ESTABLISHED 18148/java 

发现3306端口被PID为18148的Java进程占用。

进一步使用命令:ps -aux | grep java,或者直接:ps -aux | grep pid 查看
就可以明确知道3306端口是被哪个程序占用了!然后判断是否使用KILL命令干掉!
 
#启动mysql

观察

# netstat -anp  | grep 3306 
tcp        0      0 :::3306                     :::*                        LISTEN      16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:4840  ESTABLISHED 16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:4841  ESTABLISHED 16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:4842  ESTABLISHED 16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:4837  ESTABLISHED 16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:3306  ::ffff:192.168.65.211:4838  ESTABLISHED 16511/mysqld        
tcp        0      0 ::ffff:192.168.65.211:4837  ::ffff:192.168.65.211:3306  ESTABLISHED 17632/java          
tcp        0      0 ::ffff:192.168.65.211:4838  ::ffff:192.168.65.211:3306  ESTABLISHED 17632/java          
tcp        0      0 ::ffff:192.168.65.211:4840  ::ffff:192.168.65.211:3306  ESTABLISHED 17632/java          
tcp        0      0 ::ffff:192.168.65.211:4841  ::ffff:192.168.65.211:3306  ESTABLISHED 17632/java          
tcp        0      0 ::ffff:192.168.65.211:4842  ::ffff:192.168.65.211:3306  ESTABLISHED 17632/java  

 

你可能感兴趣的:(MySQL)