My local environment is:
- fresh Ubuntu 16.04
- with PHP 7
with installed MySQL 5.7
sudo apt-get install mysql-common mysql-server
When I tried to login to MySQL (via CLI):
mysql -u root -p
I came across an cyclic issue with 3 steps.
1) First was some socket issue
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
Solution: restarting PC.
Which led to another error:
2) With access denied
ERROR 1698 (28000): Access denied for user 'root'@'localhost'.
Possible issue? Wrong password for "root" user!
Solution: reset root password with this tutorial.
With correct password and working socket, there comes last error.
3) Incorrect auth plugin
mysql "ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded"
Here I stopped or somehow got to 1) again.
Try it: sudo mysql_secure_installation
Work's in Ubuntu 18.04
You can try with the below commands: