To show ongoing queries
show processlist;
To kill a process (allow the query time to rollback - especially if it's a larger query)
kill 264
Selecting data
Notice the backticks around “ignore” - this is because “ignore” is a SQL command word, but it's also a column in this table. If surrounded by backticks, the SQL interpreter will ignore the phrase/word.
SELECT device_id,ifName,ifAdminStatus,ifOperStatus,disabled,`ignore` FROM ports WHERE ifOperStatus='dormant' AND `ignore`=0 ORDER BY device_id ASC;
Deleting data
DELETE FROM <table_name> WHERE <condition_here>;
DELETE FROM employees WHERE id < 200;
DELETE FROM users WHERE age=27 OR age=41;
DELETE FROM offenses WHERE time < (NOW() - INTERVAL 30 DAY);
Updating/Changing data
UPDATE <table_name> SET <column_new_value> WHERE <condition_here>;
UPDATE ports SET `ignore`=1 WHERE ifOperStatus='dormant';
Reset/change AUTO_INCREMENT
ALTER TABLE tablename AUTO_INCREMENT = 1