It vaguely, vaguely rings a bell that you have to do something special about root, possibly to do with how MySQL gets installed initially. Lots of hits for Googling mysql root localhost permission. I may have done the stuff mentioned in https://stackoverflow.com/a/46908573 in the past. (Be careful you don't lock yourself out, however!)
But in any case what you have done now is better, as @Christian-Ehrlicher said you should not be using root user for your application.