MySQL

MySQL #

Working with JSON Columns on MySQL #

SELECT * 
FROM <tbl> 
WHERE 
    JSON_LENGTH(JSON_EXTRACT(<JSON_COLUMN>, '$.age')) > 20;

SELECT * 
FROM <tbl> 
WHERE <JSON_COLUMN>->>'$.enabled' = 'true';

Show active queries on MySQL #

show full processlist;

Kill a process on AWS RDS MySQL #

CALL mysql.rds_kill(<PROCESSID>)

Find all usages of a view on MySQL #

SELECT *
FROM information_schema.VIEWS
WHERE table_schema = '<DB_NAME>'
AND view_definition LIKE '%<VIEW_NAME>%';

Require SSL for a user on MySQL #

UPDATE mysql.user SET ssl_type = 'ANY' WHERE user = '<USER_NAME>';
FLUSH PRIVILEGES;