Enough memory but OOM killer invoked?

There's a bunch of things you need to do here.

First, the OOM killer was triggered by apache2 asking for more memory than was available, not by mysqld. But because the mysqld process was using the most memory at the time, it was the process that got killed.

Consider setting the sysctl vm.oom_kill_allocating_task, which will cause the process that asked for the memory to be killed instead.

Second, you most likely have configured Apache with mpm_prefork and are running PHP as an Apache module. This setup is slow, underperforming, not thread safe, and when PHP fails, the failure gets blamed on other components because PHP is well hidden inside of Apache. Modern web server setups use php-fpm and either nginx or Apache with mpm_event. This will give you better performance and visibility into what PHP is doing (as it is most likely what is eating up all your memory).

Finally, your droplet appears to have 1GB RAM and 1GB swap. If you're routinely running out, then your VM just may be too small. Consider adding RAM.