Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
VGSOURCES
Get listed

Database administrationPATCH 2026.10.15

How to Fix MySQL Error: Another Daemon Already Running With the Same Socket

By VGSources Team 10 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The error means two startup attempts are claiming the same Unix socket, or a socket and lock file left behind by a stopped server is being mistaken for a live owner. Find the socket path, PID, data directory, service unit, and port before deleting anything. Stop an unintended duplicate, remove an artifact only after proving that no process owns it, or give intentional MySQL instances separate sockets, ports, data directories, PID files, and logs.

What the message means

A MySQL Unix socket is a local communication endpoint, commonly named mysqld.sock. It is not a network port and it is not a database table. The server creates the socket and a companion lock mechanism so that a second mysqld process cannot silently attach to the same endpoint.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

MySQL Bug #100035 records the startup message as “Another process with pid 12466 is using unix socket file.” The PID in that message is the process identifier MySQL found in the socket lock information. It is evidence of a collision, not proof that the process is the server you intended to run. The PID may belong to a healthy instance, a duplicate service, or no current process at all if an unclean shutdown left stale files.

There are two separate paths to check:

  • Unix-socket path: used for local connections, usually when a client specifies localhost or no host.
  • TCP endpoint: normally port 3306 unless the instance was configured otherwise.

A server can be healthy on one socket while a client fails because it is looking at another path. MySQL connection documentation notes that localhost normally selects Unix-socket transport unless the connection parameters force TCP.

Do not delete the socket first

Deleting mysqld.sock is safe only after you have established that no running MySQL process owns it. Removing a live server’s socket can break local clients while leaving the server and its data running, and removing files in the wrong data directory can cause a much more serious outage.

Before changing anything, preserve the evidence:

  • Copy the complete error message and the time of the failed start.
  • Record the socket path, PID, data directory, TCP port, and error-log path shown in the log.
  • Note which service unit was started and which account owns the process and files.
  • Do not run kill -9, delete a PID file, or remove a whole directory as a first response.

Safe diagnostic sequence

1. Read the complete error log

The short message printed by a service manager often omits the useful details. Read the MySQL error log around the failed start. On a systemd installation, try the unit name used by your distribution:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo journalctl -u mysql -b --no-pager
sudo journalctl -u mysqld -b --no-pager

If the unit writes to a file instead, use the log-error setting or the path printed by the service status. Capture every line that names socket, pid-file, datadir, port, or a process ID. Different option files can give different answers, so the values in the failing instance’s log take priority over assumptions based on a familiar default.

2. Identify the service manager and every MySQL process

Check the likely service names without assuming that mysql and mysqld are interchangeable on your distribution:

sudo systemctl status mysql
sudo systemctl status mysqld
sudo systemctl status mariadb

Then list processes:

ps -eo user,pid,ppid,cmd | grep '[m]ysqld'

For each process, inspect its command line and parent. A manually launched server may not appear as an active package service, while a package-managed instance normally has a service unit as its ancestor. If the error cites PID 12466, inspect that exact process before stopping anything:

sudo ps -p 12466 -o user,pid,ppid,lstart,cmd
sudo tr '' ' ' </proc/12466/cmdline

Look for --datadir, --socket, --port, and --defaults-file. Those options tell you which instance you are looking at. A process using a production data directory is not an expendable duplicate merely because it blocked a new start.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Check the socket and TCP port independently

Verify whether the configured Unix socket is actively open:

sudo ss -lxnp | grep -E 'mysql|mysqld'
sudo lsof -nP -U | grep mysqld

Check the TCP listener as well:

sudo ss -ltnp | grep ':3306'

If another process owns port 3306, a socket cleanup will not solve the resulting port collision. Conversely, a free TCP port does not prove that the Unix socket is free. Check both transports because an instance can be reachable over TCP while its local socket setting is wrong.

4. Test the server that appears to be running

When a process owns the socket, test that exact endpoint rather than testing a client default:

mysqladmin --socket=/path/from/error-log ping
mysql --protocol=SOCKET --socket=/path/from/error-log -e 'SELECT @@socket, @@port, @@datadir;'

Authentication failures are different from transport failures. If the command reaches MySQL and returns an access-denied response, the socket is working and you should address credentials or account permissions instead. If it cannot open the socket, verify the path and file permissions again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Compare configuration sources

MySQL and its clients may read different option files. A server started with one --defaults-file can create a socket in a directory that a client configured through another file never checks. Review the service’s startup command, distribution defaults, and any administrator-created files such as my.cnf. Where available, my_print_defaults mysqld can show options supplied to the server group, but it does not replace checking the command line and the running process.

6. Decide which instance should own the endpoint

At this point classify the collision before taking action:

Evidence Meaning Action
A healthy, intended server owns the socket and has the expected data directory The new start is an unintended duplicate or is configured with the wrong endpoint Keep the running server; stop the duplicate or reconfigure the new instance
The PID in the message no longer exists and no process owns the socket or port A stale socket or lock artifact is plausible Back up and remove only the stale artifact, then start the intended service
Two required servers have different data but share a socket, port, or data directory The multi-instance configuration is incomplete Assign separate instance values before starting both
The server is running but a client using localhost fails The client and server disagree about the socket path or transport Use the server’s socket explicitly or force TCP with the correct host and port

Fix an unintended duplicate service

This is the usual cause after installing a second package, enabling a service twice, or launching mysqld manually while the distribution unit is already active.

  1. Use the process and data-directory information to identify the instance that must remain online.
  2. Stop the other instance through its own service manager. For example, if the duplicate is the mysqld unit, run sudo systemctl stop mysqld; use mysql or another unit name when that is the unit actually owning the process.
  3. Confirm that the duplicate process exits and that its socket and port are no longer open.
  4. Start the intended unit with sudo systemctl start mysql or the correct service name.
  5. Review enablement and startup scripts so the duplicate is not launched again at the next reboot. Inspect the unit and any custom drop-ins with systemctl cat before disabling anything; do not disable the service that owns the production data.

A clean stop is preferable to killing the process. If a service refuses to stop, inspect its journal and parent process first. Forced termination can create the stale-artifact condition you are trying to resolve.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove a stale socket or lock artifact safely

Use this path only when the PID is absent or unrelated, no mysqld process owns the Unix socket, and the TCP port check agrees that the intended server is not already running.

  1. Stop the service you are repairing: sudo systemctl stop mysql or the unit name shown by your status check.
  2. Re-run the process, socket, and port checks. A service that reports stopped but still has a child process needs further investigation.
  3. Back up the exact socket and lock paths named in the log. For example:
SOCKET=/path/from/error-log
sudo cp -a "$SOCKET" "$SOCKET.backup"
sudo cp -a "$SOCKET.lock" "$SOCKET.lock.backup"

The lock filename can vary, so use the path actually present on your system. If a backup command reports that a file is absent, do not substitute a broad wildcard.

  1. Remove only the stale socket and its confirmed companion lock file:
sudo rm -- "$SOCKET" "$SOCKET.lock"
  1. Start the intended unit and immediately read its error log:
sudo systemctl start mysql
sudo systemctl status mysql --no-pager
  1. Verify the resulting socket, port, data directory, and a real client connection. Keep the backups until the service has completed a normal restart.

Do not remove the entire data directory, an unrelated PID file, or every file matching *.sock. A stale artifact diagnosis applies to the specific endpoint named by the failed instance, not to every MySQL-related file on the machine.

Run two MySQL servers intentionally

Two instances can share one host, but they cannot share resources that identify or store an instance. MySQL’s multiple-server guidance requires a second server to use a separate data directory and different --socket and --port values. In practice, give each instance its own PID file, error log, and service unit too.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Values every instance needs

  • Data directory: each server must initialize and use its own directory. Never point two writable servers at the same data directory.
  • Unix socket: choose a distinct pathname for local clients.
  • TCP port: use a distinct listening port for TCP clients.
  • PID file: keep process identity files separate so one service cannot read another’s PID.
  • Error log: separate logs make startup ownership and recovery possible.
  • Service unit: start and stop each instance independently.

Systemd installations can use instance-specific groups such as [mysqld@replica01] and [mysqld@replica02]. Each group should define that instance’s datadir, socket, port, and log-error. The corresponding template units can then be started separately, for example with mysqld@replica01. Distribution packages may use a different template name, so inspect the installed unit before creating overrides.

After configuring an instance, validate it in isolation: start only that unit, confirm its process command line and listeners, connect through its explicit socket and port, then start the other unit. This sequence makes it clear which configuration introduced a collision.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix a running server that local clients cannot reach

If mysqld is healthy but an application reports that the socket is missing or in use, compare the client’s endpoint with the server’s actual setting.

Use the server’s Unix socket explicitly

Pass the exact path shown by @@socket or the server error log:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mysql --protocol=SOCKET --socket=/actual/path/mysqld.sock -u user -p

Applications need the same path in their connection configuration. A common failure is changing the server socket while leaving a command-line client, PHP configuration, or application environment variable pointed at the old pathname.

Force TCP deliberately

When local socket files are inconvenient or separate instances are being tested, force TCP and specify the intended port:

mysql --protocol=TCP -h 127.0.0.1 -P 3306 -u user -p

Using 127.0.0.1 with an explicit TCP protocol avoids the special localhost socket behavior. This does not fix a server that failed to bind its TCP port; it only ensures that the client is testing the transport you selected.

Why the error often appears after a reboot

A reboot can expose a configuration collision that was hidden while an administrator started one instance manually. Common patterns include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • A package-managed service is enabled and starts automatically, while an old startup script launches a second mysqld.
  • A shutdown was interrupted, leaving a socket or lock artifact that the next start interprets as occupied.
  • Two unit files read different option files and both fall back to the same default socket and port.
  • A data directory was restored or copied without updating the instance-specific socket, PID, and log settings.

Compare the boot journal with the service unit and the process command line. The first process to start is not automatically the correct one; ownership of the data directory and the intended service definition determine which instance should survive.

Common mistakes and their safer alternatives

Killing the PID from the error blindly

The reported PID may be the production server. Inspect its command line, parent, data directory, and listeners first. Stop the owning service cleanly when it is the duplicate; do not assume that a high or old PID is stale.

Deleting a socket while a server is alive

A socket pathname is only an artifact, but an active process depends on it for local clients. Prove that no process owns the path with ss or lsof and confirm the service state before removal.

Changing only the port for a second instance

A different TCP port does not resolve a shared Unix socket or data directory. Separate every identity and storage value: data directory, socket, port, PID file, log, and service unit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Testing with the wrong transport

A successful TCP test does not validate a Unix socket, and a failed localhost connection does not prove that the server is down. State the protocol, socket, host, and port in every diagnostic test.

Editing a client file when the server is the problem

Changing client defaults can hide a collision rather than fix it. First establish which server owns the endpoint; then align client settings with that intentional configuration.

Compact recovery checklist

  1. Read the full error log and record socket, PID, port, data directory, and service unit.
  2. List all mysqld processes and inspect the cited PID.
  3. Check Unix-socket ownership and TCP listeners separately.
  4. Connect to any healthy instance through its explicit socket or port.
  5. Stop an unintended duplicate through its service manager.
  6. For a stale artifact, stop the service, prove no process owns the path, back up the files, and remove only the named socket and lock file.
  7. For multiple intentional instances, assign separate data directories, sockets, ports, PID files, logs, and units.
  8. After the fix, test both the server endpoint and the client configuration that originally failed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Database administrationLinuxMySQLsystemdtroubleshootingUnix sockets

Leave a reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.