MySQL "Bind on TCP/IP port: Address already in use"

最近在已部署MySQL Enterprise Monitor的服务器上新增了MySQL实例,导致MySQL Enterprise Monitor异常宕机了,无法重新启动成功。收到了Bind on TCP/IP port: Address already in use的错误提示。下面是这个问题的解决办法,供大家参考。

1、故障现象
[[email protected] init.d]# ./mysql-monitor-server start
Starting mysql service  [ OK ]
150127 09:57:34 mysqld_safe Logging to ‘/opt/mysql/enterprise/monitor/mysql/runtime/mysqld.log‘.
150127 09:57:35 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/enterprise/monitor/mysql/data/
./mysql-monitor-server : tomcat  (pid 28303) already running
150127 09:57:42 mysqld_safe mysqld from pid file /opt/mysql/enterprise/monitor/mysql/runtime/mysqld.pid ended

2、故障分析
#查看日志,提示为Bind on TCP/IP port: Address already in use,地址在使用,如下
[[email protected] init.d]# tail -100 /opt/mysql/enterprise/monitor/mysql/runtime/mysqld.log |grep "ERROR" -A5
2015-01-27 09:57:36 30753 [ERROR] Can‘t start server: Bind on TCP/IP port: Address already in use
2015-01-27 09:57:36 30753 [ERROR] Do you already have another mysqld server running on port: 13306 ?
2015-01-27 09:57:36 30753 [ERROR] Aborting

2015-01-27 09:57:36 30753 [Note] Binlog end
2015-01-27 09:57:36 30753 [Note] Shutting down plugin ‘partition‘
2015-01-27 09:57:36 30753 [Note] Shutting down plugin ‘ARCHIVE‘
2015-01-27 09:57:36 30753 [Note] Shutting down plugin ‘BLACKHOLE‘
2015-01-27 09:57:36 30753 [Note] Shutting down plugin ‘ARCHIVE‘
2015-01-27 09:57:36 30753 [Note] Shutting down plugin ‘BLACKHOLE‘

#根据上述错误提示,核查缺省的mysql enterprise monitor 端口号13306,如下,并没有被占用
[[email protected] init.d]# netstat -nltp|grep mysql
tcp        0      0 :::3306                     :::*                        LISTEN      8734/mysqld         
tcp        0      0 :::3307                     :::*                        LISTEN      9489/mysqld

3、故障解决

#故障现象里有一个提示为tomcat  (pid 28303) already running
#这个引起了我的注意,于是尝试先kill到tomcat相关进程
[[email protected] init.d]# ps -ef|grep 28303|grep -v grep
mysqlmem 28303 28302  4 Jan20 ?        07:35:03 jsvc.exec -java-home /opt/mysql/enterprise/monitor/java
 -user mysqlmem -pidfile /opt/mysql/enterprise/monitor/apache-tomcat/temp/catalina.pid -wait 10 -outfile
 /opt/mysql/enterprise/monitor/apache-tomcat/logs/catalina-daemon.out -errfile &1 -classpath
 /opt/mysql/enterprise/monitor/apache-tomcat/bin/bootstrap.jar:
 /opt/mysql/enterprise/monitor/apache-tomcat/bin/commons-daemon.jar:
 /opt/mysql/enterprise/monitor/apache-tomcat/bin/tomcat-juli.jar -Dnop -Xmx768M -Xms768M
 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/mysql/enterprise/monitor/apache-tomcat/temp
 -XX:+UseParallelOldGC -XX:MaxPermSize=512M -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
 -Djava.endorsed.dirs= -Dcatalina.base=/opt/mysql/enterprise/monitor/apache-tomcat
 -Dcatalina.home=/opt/mysql/enterprise/monitor/apache-tomcat
 -Djava.io.tmpdir=/opt/mysql/enterprise/monitor/apache-tomcat/temp org.apache.catalina.startup.Bootstrap

[[email protected] init.d]# kill -9 28303
#再次检查是否有tomcat相关进程存在,逐一kill tomcat相关进程
[[email protected] init.d]# ps -ef|grep tomcat
[[email protected] init.d]# kill -9 28302
[[email protected] init.d]# kill -9 30867
# Author : Leshami
# Blog   : http://blog.csdn.net/leshami

#再次重新启动mysql em,此时启动正常
[[email protected] init.d]# ./mysql-monitor-server start
Starting mysql service  [ OK ]
150127 10:16:08 mysqld_safe Logging to ‘/opt/mysql/enterprise/monitor/mysql/runtime/mysqld.log‘.
150127 10:16:08 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/enterprise/monitor/mysql/data/
Starting tomcat service  [ OK ]

#检查mysql em的状态
[[email protected] init.d]# ./mysql-monitor-server status
MySQL Enterprise MySQL is running
MySQL Enterprise Tomcat is running

#检查mysql 的端口号
[[email protected] init.d]# netstat -nltp|grep mysql
tcp        0      0 :::3306                     :::*                        LISTEN      8734/mysqld         
tcp        0      0 :::3307                     :::*                        LISTEN      9489/mysqld         
tcp        0      0 :::13306                    :::*                        LISTEN      31584/mysqld

时间: 2024-10-11 22:02:01

MySQL "Bind on TCP/IP port: Address already in use"的相关文章

mysqld启动“ Can't start server: Bind on TCP/IP port: Address already in use

[[email protected] ~]# vi /var/log/mysqld.log 进入log日志发现报以下的错误: 170901  4:56:54  InnoDB: Initializing buffer pool, size = 8.0M170901  4:56:54  InnoDB: Completed initialization of buffer pool170901  4:56:55  InnoDB: Started; log sequence number 0 44233

修改mysql端口后重启mysql报错:Can't start server: Bind on TCP/IP port. Got error...n denied

1:错误信息:如下 [[email protected] ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.2.30 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/mariadb.service.d └─

linux socket TCP UDP bind 同义IP和port

//TCP and UDP can bind to the same IP & port. #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <assert.h> #include <stdio.h> #include <unistd.h> #include &

redis数据导出,报错Could not connect to Redis at ip:port: Cannot assign requested address解决方法

因为需啊把redis的数据导出和数据库数据作对比,用管道符连接的方式导出数据: /opt/$company_name/redis-3.0.5/bin/redis-cli -h $IP -p $PORT  -a  $PASSWORD  keys  \* |xargs -n 1 /opt/$company_name/redis-3.0.5/bin/redis-cli -h   $IP -p $PORT -a  $PASSWORD  get > key.txt 导出过程中,报错 : Could not

Java JDBC连接SQL Server2005错误:通过port 1433 连接到主机 localhost 的 TCP/IP 连接失败

错误原因例如以下: Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99) at org.hibernate.exception.JDBCExceptionHelper.convert(J

mysql启动异常之--TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS

错误显示内容: 6716 [ERROR] TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS 6716 [ERROR] Aborting 解决方法: 1. 取消 enable-named-pipe 前注释,或添加这行 skip-name-resolve skip-external-locking enable-named-pipe        #这一行参数 2. mysql开启TCP/IP监听端口,注释s

Deploying OpenFire for IM (instant message) service (TCP/IP service) with database MySQL , client Spark on linux部署OpenFire IM 消息中间件服务

Are you a hacker? How to build another QQ/Wechat/whatsapp/skype/imessage? Let's go through this!!!! Materials: A linux/unix/windows/mac computer/server, and do some basic things! Are you feeling high? Okay, let's ride the rocket! Get materials: 1. A

mysql错误:Can’t create TCP/IP socket (10106)

昨天晚上十一点半,有个女同学打电话说电脑出问题了,说tomcat和mysql打不开了,各种急!因为后天就要答辩了,这些软件打不开,系统也就运行不起来!大半夜的让我怎么办,只好说明天早起帮看看! 早早的起来了,接过同学的电脑!回到宿舍看了一下,mysql果然打不开报了这样的错误"mysql错误:Can't create TCP/IP socket (10106)",目测是socket端口被占用的原因,然后在打开tomcat,报的错误中也包含了"socket",再一次加

通过TCP/IP连接Mysql数据库

问题:mysql只能用localhost或127.0.0.1连接 解决:mysql安装完后,默认是root用户,root用户只能在服务器登录,需要分配新用户. 1.以root用户登陆mysql数据库. 2.执行一下命令分配新用户: grant all privileges on *.* to '用户名'@'IP地址' identified by '密码'; 'all privileges ':所有权限 也可以写成 select ,update等.*.* 所有库的所有表 如 databasenam