Login to database with user root,
then select database mysql and update password field with no password.
or, you may delete the password only for localhost:
then select database mysql and update password field with no password.
$ mysql -u root -p
mysql> use mysql;
mysql> update user set password = '' where user = 'root';
or, you may delete the password only for localhost:
mysql> update user set password = '' where user = 'root' and host = 'localhost';