The magic query to delete a row based on your custom settings is:
delete from [table name] where [column name] like '%[text to find]%'
You'll need to understand how this works to change the variables.
delete - means to delete a row
[table name]
- this is the table you want to search in
[column name]
- this is the column you want to search in
%[text to find]%
- this field needs the % characters on either side of the keyword to search for all strings with that word in it.
In this working example, spammers added thousands of users with a blog name in the username. We went into phpmyadmin and ran a quarry to remove them all with this code:
delete from wp_users where user_login like '%blogname%'