Database ServerMySQL

[Solved] Another mysqld server running on port: 3306

MySQL is one of the most widely used open source relational database management tool (RDMS) based on structured query language (SQL).

The most common error received while installing MySQL on the server and starting/restarting the MySQL service on a *nix server is:

[ERROR] Can't start server: Bind on TCP/IP port: Address already in use
[ERROR] Do you already have another mysqld server running on port: 3306 ?
[ERROR] Aborting

Looking at the above error, it seems to be an issue with the MySQL service running on the default port 3306.

Lets troubleshoot MySQL  service starting error considering different scenarios.

Scenario 1:

Step 1:

Check the MySQL service status by running below command:

/etc/init.d/mysqld status

Step 2:

If MySQL service is running then stop the service by running below command else skip to step 3.

/etc/init.d/mysqld stop

Step 3:

Check if MySQL service port 3306 is still in use or not by running below command:

netstat -apn | grep 3306

If port is still in use then check the service running on it. If any other service is running on the port 3306 then you will have to either configure MySQL to run on port other than 3306 or stop the service running on port 3306, re-configure its port to some other port number.

Check this post for all the steps to change default port number 3306 on which MySQL service runs.

Step 4:

If MySQL service is found running in step 3 then kill the service using below command:

kill -9 pid

Note: pid is the proceed id you get after running command specified in step 3.

Step 5:

Start the MySQL service using below command:

/etc/init.d/mysqld start

Scenario 2:

Step 1:

Check the bind address in the MySQL configuration file my.cnf generally locate at /etc/my.cnf.

Step 2:

Set the bind address IP as per the requirement (mostly localhost / 127.0.0.1) 

bind-address = 127.0.0.1

You may comment the bind-address field if MySQL service is running on the server itself.

#bind-address = 127.0.0.1

If you are using remote server for MySQl then provide the server IP in the bind-address field.

bind-address = 121.121.134.123

In the above snippet the MySQL is summed to be running on remote server 121.121.134.123

Step 3:

Start the MySQL service

/etc/init.d/mysqld start

Hope this helps!

Abhijit Sandhan

Love to Automate, Blog, Travel, Hike & spread Knowledge!

Related Articles

One Comment

  1. I am facing issue during replication implementation but not got solution:

    2017-09-24 13:53:07 22618 [Note] Plugin 'FEDERATED' is disabled.
    2017-09-24 13:53:07 22618 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2017-09-24 13:53:07 22618 [Note] InnoDB: The InnoDB memory heap is disabled
    2017-09-24 13:53:07 22618 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2017-09-24 13:53:07 22618 [Note] InnoDB: Memory barrier is not used
    2017-09-24 13:53:07 22618 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2017-09-24 13:53:07 22618 [Note] InnoDB: Using Linux native AIO
    2017-09-24 13:53:07 22618 [Note] InnoDB: Using CPU crc32 instructions
    2017-09-24 13:53:07 22618 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2017-09-24 13:53:07 22618 [Note] InnoDB: Completed initialization of buffer pool
    2017-09-24 13:53:07 22618 [Note] InnoDB: Highest supported file format is Barracuda.
    2017-09-24 13:53:07 22618 [Note] InnoDB: 128 rollback segment(s) are active.
    2017-09-24 13:53:07 22618 [Note] InnoDB: Waiting for purge to start
    2017-09-24 13:53:07 22618 [Note] InnoDB: 5.6.37 started; log sequence number 1626223
    2017-09-24 13:53:07 22618 [Note] Server hostname (bind-address): '*'; port: 3306
    2017-09-24 13:53:07 22618 [Note] IPv6 is available.
    2017-09-24 13:53:07 22618 [Note] - '::' resolves to '::';
    2017-09-24 13:53:07 22618 [Note] Server socket created on IP: '::'.
    2017-09-24 13:53:07 22618 [ERROR] Can't start server : Bind on unix socket: Address already in use
    2017-09-24 13:53:07 22618 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?

Leave a Reply to shafique Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button