I am trying to drop database in mysql with following command

DROP database db-name; 

Its take a very long and I faced some issue with the same DB related to table lock and all so I thought to check is there any process active for same DB with the following command

SELECT * FROM information_schema.processlist WHERE DB = 'db-name';

its shows one process is there so I kill that process using Kill 66

and then again run the same command

SELECT * FROM information_schema.processlist WHERE DB = 'db-name';

so now its shows empty set so I tried again to drop the database using same command but again same result .

I am using MySQL 8.0 command line client to run all commands , even I use workbench its shows timeout MySQL connection error after few minutes trying to drop the database .

Just to add one more thing I am using root user with all permission , so no issue regarding permissions .

after I run the drop database information schema

  • Yes there are and they are showing in db as null and command is use db-name , which I am trying to drop. Sep 2, 2022 at 7:22
  • Execute SHOW ENGINE INNODB STATUS in separate CLI window and look what locks the metadata.
    – Akina
    Sep 2, 2022 at 9:31
  • There are other schema on that server , so its shows transactions related to those but none is related to this schema. Sep 2, 2022 at 11:12
  • 1
    There still could be a query holding onto that schema, while its default database is in some other schema. Cross-schema queries are possible if they reference the tables using qualified identifiers. Unfortunately, it's hard to find which session is responsible. Sep 2, 2022 at 19:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.