[update] I solve the problem by :
SET PASSWORD FOR 'root'@'ma'=PASSWORD('pass');
And I still have a question want to ask:
should I set password for 127.0.0.1
and ::1
???
What's these two root user is???
[original question]
I have a server
I can log in DB on the server
From my computer,I can access ,too.
BUT WHEN I put the code on tomcat on that server
I run the code and got error : Access denied for user 'root'@'master' (using password: YES)
I guess it's because my code is jdbc:mysql://192.168.xx.xx:3306/project
not jdbc:mysql://127.0.0.1:3306/project
How can I fix this problem?? What should I set ?
It's a question of
GRANTs
:For connecting to an IP address or hostname:
For connecting to
localhost
(alias127.0.0.1
) -- That is, when the client is on the same machine as the server:(Actually, you can use either technique to connect from the same server.)