I got this after a crash in Moodle 3.3. I was unable to connect to mysql through any means: Moodle, phpmyadmin, or SQuirreL.
When Moodle crashed, it appears that it left a mysql.pid file. I renamed this, restarted Moodle/MySQL, and all worked well. It created a new mysql.pid file.