If you created a query monster and doesn’t seem to end and is eating up all of your resources, you can stop it.
Run mysql as root on the command line.
sudo mysql -u root -p
Then to show the mysql processes/queries that are running, type:
show processlist;
Get the ID of the query (e.g. 815) and, to kill it, type:
kill 815;
exit
and that’s it.