mysql_upgrade error 2002 during apt upgrade
It’s been a while and today I was stuck on an older machine trying to upgrade a broken mysql update.
I had this error during the
sudo apt upgrade command:
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
After trying different solutions posted on StackOverflow, I was able to fix it with this combination of commands:
sudo systemctl enable mysql sudo service mysql start sudo apt dist-upgrade
This bug is reproducible by running
sudo systemctl disable mysql before a MySQL upgrade.