innodb_buffer_pool_size is the one setting that matters

Almost every MySQL tuning guide lists forty variables, and on a dedicated server the first one accounts for most of the difference — it is the cache that holds data and indexes in memory.

SELECT
  ROUND(SUM(data_length + index_length) / 1024 / 1024) AS total_mb
FROM information_schema.tables WHERE table_schema NOT IN
  ('mysql','information_schema','performance_schema','sys');

SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool_read%';
-- hit rate = 1 - (reads_from_disk / read_requests)

The rule of thumb is 60-70% of RAM on a dedicated database server and considerably less on a machine also running PHP — the default of 128 MB is a value chosen so MySQL starts anywhere. A hit rate below 99% under normal load means the working set does not fit, which is worth knowing before optimising any individual query. It is dynamically resizable in 5.7 and later, so the experiment does not need a restart.