Search code examples
mysqllinuxdatabaseportdatabase-administration

How to fix: MySQL can not start: Error "another mysqld server running on port: 3306?" - checked port and it is FREE


I have encountered a strange error with MySQL service. I can not start it due to the problem related to ports. I have checked my error logs:

2021-03-18T10:02:22.507114Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2021-03-18T10:02:22.507246Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2021-03-18T10:02:22.508080Z 0 [ERROR] [MY-010119] [Server] Aborting

I have checked some other threads on StackOverflow about this issue, so I decided to try the solutions.

I checked all my ports with:

netstat -tulpn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:12526           0.0.0.0:*               LISTEN      485/sshd
tcp        0    232 172.16.2.34:12526       10.200.0.62:62217       ESTABLISHED 898/sshd: sop [priv
tcp6       0      0 :::80                   :::*                    LISTEN      547/apache2

As you can see, there is nothing associated with port 3306. To be sure, I checked that with:

lsof -i TCP:3306

I decided to try changing the port that MySQL uses. I opened the configuration file and changed the port to the different one that FOR SURE must be free (again, I checked that).

port = 6606

Unfortunately, it only resulted into changed error log:

2021-03-18T10:22:22.507114Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2021-03-18T10:22:22.507246Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 6606 ?
2021-03-18T12:02:22.508080Z 0 [ERROR] [MY-010119] [Server] Aborting

All solutions I have seen, require to kill the program that occupy the port, but how do I am supposed to do so when there is no such program? What else can I consider? I wonder if I will just end up with reinstalling MySQL, because I have no idea what to do with this error...

I would like to admit that MySQL has worked very well so far, and I cannot pinpoint why it suddenly stopped working properly. No significant changes have been made to the system. No services were installed that could started to use ports that MySQL wants to use.

I use MySQL on Linux Debian 10.

Thank you in advance for all your help and time. :)


Solution

  • After more researches and efforts, I decided to fully reinstall MySQL service, because I did not find anything working. Now everything is working fine, but I hope that I will not encounter something hopelessly similar in the future.