Reset the MySQL Root Password to fix Access denied for user ‘root’@’localhost’
Stop the current MySQL server instance: sudo service mysql stop.
Use dpkg to re-run the configuration process that MySQL goes through on first installation. You will again be asked to set a root password. sudo dpkg-reconfigure mysql-server-5.5 or whatever your mysql-server version.