Login to mysql via command line and then run flush privileges command like this:
Then change the 'root'@'localhost' account password. Replace the password with the password that you want to use. To change the password for a root account with a different host name part, modify the instructions to use that host name.
MySQL 5.7.6 and later:
MySQL 5.7.5 and earlier:
Source : http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html