Skip to main content

Fixed: "ERROR 1095 (HY000): You are not owner of thread" in MySQL

· 3 min read
Jagdish Kumawat
Founder @ Dewiride

KILL failed with ERROR 1095 (HY000): You are not owner of thread 183. An ordinary account can only stop its own connections, so this one needs another account's help, or a privilege that shouldn't go to an application.

What I Was Doing​

I was connected as the application's account, inventory_app, on MySQL 9.7.4 in Docker, and tried to end a connection I'd found in the list:

mysql
KILL 183;

What I Expected​

Query OK, and connection 183 gone.

What I Got​

Output
ERROR 1095 (HY000): You are not owner of thread 183

A mysql session where KILL 183 fails with ERROR 1095 (HY000): You are not owner of thread 183.

What I Checked​

Whose connection it was. 183 was root's session, in another terminal.

The KILL page. It says: "Without CONNECTION_ADMIN or SUPER, you can kill only your own threads and statements."

Why It Happens​

Ending someone else's connection rolls back their work, so MySQL treats it as an administrator's decision. Two connections of the same account count as your own, which is why an application account can end its own stuck connections and nobody else's.

The Fix​

Run it from an account that's allowed to, here root:

mysql: root session
KILL 184;

If someone needs this regularly, grant that one right, and not SUPER, to an account for that purpose:

mysql: root session
GRANT CONNECTION_ADMIN ON *.* TO 'some_admin'@'%';

Don't give it to your application's account.

After the Fix​

Output
Query OK, 0 rows affected (0.001 sec)

KILL 184 succeeding from a root session with Query OK.

Common Mistakes​

MistakeWhat happensDo this instead
Granting SUPER to fix itIt's deprecated, and far too broadUse CONNECTION_ADMIN
Giving the right to the app's accountA compromised app can end anyone's connectionUse a separate account
Killing before checking what it's doingSomeone's work is rolled backLook first

Troubleshooting​

SymptomLikely causeFix
Unknown thread idThe connection has goneERROR 1094
It works for some connections, and not othersThose are your own account'sThat's the rule
A managed database refuses even for its adminHosting providers can restrict itCheck your provider's way of killing connections

Conclusion​

ERROR 1095 means the connection isn't yours to end. Use an account with CONNECTION_ADMIN, or get its owner to finish, and keep that right away from your application.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.