Where are tags stored in the database?
Tags are Elements and are stored in multiple places in the database, so editing the db directly may not be as easy as just finding the Tags you want and deleting them.

The tag itself is stored in multiple places including the tables:

content
elements
elements_sites
tags


You'll find the Tag Name that you recognize in the content table in the title column. However, the only way to delete the references to a given tag in all of the tables would be to delete it by it's Element ID in the elements table, which would cascade through the other tables and clean them up as well.

Quite possible to do via the db directly, but probably not advisable or convenient in many situations. Be sure to backup your database before you try, if you dare.



In the case this must be done manually, you could consider the following steps:

Export all tags from the db into a CSV file. Select all the ones you wish to delete. Use your spreadsheet to combine all the Element IDs of the tags you want to delete into a comma-delimited list. Then return to your database program and delete all the Tags by their Element IDs:

DELETE FROM elements
WHERE id IN (1, 3, 5, 7, 9);