These steps can help identify slow queries for mysql database
List all active MySQL processes.
mysql -u <DB_USER> -p <DB_PASSWORD> -e "SHOW FULL PROCESSLIST;"
View the last 100 lines of the MySQL slow query log.
sudo tail -n 100 /var/log/mysql/mysql-slow.log
Display the MySQL configuration file.
cat /etc/mysql/my.cnf
Show disk space usage in a human-readable format.
df -h
View the last 100 lines of the system log.
sudo tail -n 100 /var/log/syslog
Check the status of the MySQL service.
sudo systemctl status mysql.service
Connect to the database and EXPLAIN a given slow query
mysql -u <DB_USER> -p <DB_PASSWORD> -e "USE <DB_NAME>; EXPLAIN <SLOW_QUERY>"