I am attempting to connect to mySQL through a NodeJS file, but I receive the following error:
{ Error: ER_ACCESS_DENIED_ERROR: Access denied for user \'root\
I was facing same error on mac, however whenever I run same code on windows machine it was working absolutely good, without any error. After spending 2 days I found solution.
Below are the steps I followed.
e.g. Avi-MBP:projectDirectory avisurya$ sudo su -
it will as password e.g. Password: enter your mac user password
Now you will be in root e.g. Avi-MBP:~ root#
now again go to project directory e.g. Avi-MBP:~ root# cd /Users/avisurya/projectDirectory
now start node application e.g. in my case "node server.js"