Mysql server installed just fine by using the following command:
sudo apt-get install mysql-server
During installation I was prompted to choose a root password. After install I was able to log in to mysql monitor using this command:
mysql -u root -p
and when prompted I entered the password and logged in successfully.
When I reboot my server and then try to login to mysql monitor, upon entering the password I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
When I look in
/var/run/mysqld/ I do not see any file called
mysqld.sock. Previously before the reboot there was a file by that name in that location. It was also highlighted red in my client shell program (mRemoteNG).
If I try to create that file by doing:
sudo touch mysqld.sock
It does get created but it isn't highlighted red, and when I try to login again, I get the same error as before.
I have tried uninstalling and reinstalling mysql and mysql-server countless times and the same issue arises every time.
I also tried stropping and starting mysql service and that didn't make any difference.
I am only prompted to choose a password during the very 1st install of mysql-server on a clean Ubuntu install. After that whenever I uninstall and reinstall it, it doesn't prompt me to choose a password, just says it has been installed successfully.
How to properly install mysql-server so that it will always be there even after rebooting the server?