MySQL Error:Access denied for user ‘root@localhost’

ERROR 1045(28000) : Access denied for user ‘root@localhost’ (using password: no )

Access denied error occurs normally when you are not using the correct password and you have to reset the password if not sure.
You can reset the password by following the steps listed below.

service mysql stop

Make sure that there is no MySQL process running:

ps aux | grep mysql

Use kill command if any MySQL process is still running:

killall -9 mysql

After that start the MySQL server in safe mode:

/usr/bin/mysqld_safe --skip-grant-tables &

You will be able to connect to MySQL using the MySQL command as below.
mysql2
Select MySQL database:

use mysql;

Set the password for root.

update user set password=PASSWORD("putpasswordhere") where user='root';

If you want to access MySQL without password, use the following command:

update user set password=PASSWORD("") where user='root';

After reload the privileges and restart MySQL

flush privileges;
service mysql start

Now check running the following commands.

mysql
or
mysql -u root -p

Previously we have talk about another common MySQL error it can also be helpful for you: NO WEB PAGE WAS FOUND FOR THE WEB ADDRESS: “..DATABASES/PHPMYADMIN/EXPORT.PHP”.