If you have that same problem in MySql 5.7.+ :
Access denied for user 'root'@'localhost'
it's because MySql 5.7 by default allow to connect with socket, which means you just connect with sudo mysql. If you run sql :
SELECT user,authentication_string,plugin,host FROM mysql.user;
then you will see it :
+------------------+-------------------------------------------+-----------------------+-----------+
|...
Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?
Continue reading Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?