MySQL said: 'reading initial communication packet', system error: 0

I use Sequel Pro and got this error when trying to connect to my database:

MySQL said: Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I did not find out the exact problem, but thanks to this article, I got it working by running sudo reboot.