# InnoDB: Unable to lock ./ibdata1 error: 11 / Another process with pid is using it

**Code:** `unable to lock ibdata1` · **Category:** MySQL · **Seen on:** MySQL

A second mysqld (or a stale process) holds the InnoDB data file, so the new server cannot start.

## Meaning

InnoDB takes an advisory lock on `ibdata1` at start-up. If an old server is still running, or two instances share a data directory, the lock fails and the server exits.

## Common causes

- Previous mysqld still running
- Two instances using the same datadir
- Stale lock after a crash on NFS
- Container started twice with the same volume

## Quick fix

1. Find and stop the other process (`ps aux | grep mysqld`)
2. Use a unique datadir per instance
3. Avoid NFS for the data directory

## Detailed fix by platform

### Linux

1. `ps aux | grep [m]ysqld` and `sudo lsof /var/lib/mysql/ibdata1`

## How to diagnose

1. **Process** — Another mysqld?
2. **Datadir** — Shared?
3. **Filesystem** — Local disk?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/mysql/innodb-unable-to-lock-ibdata1)
