linux - Amazon EC2 Tomcat7 instance unable to access MySQL db on same system -


i think i've seen variety of similar posts on topic, still unable resolve issue, figured i'd post specifics.

i have amazon aws linux ec2 instance running tomcat7 web server. on same machine running mysql5 server, unable tomcat app talk mysql database.

my java app on tomcat tries connect mysql reading properties file:

jdbc.mysql.host.path=jdbc:mysql://localhost/   jdbc.mysql.schema=prod   jdbc.mysql.username=root   jdbc.mysql.password=<password>   

i accessing app system via web browser, when app tries connect database following error in catalina.out:

java.sql.sqlexception: access denied user 'root'@'localhost' (using password: yes) 

i'm pretty sure issue has permissions , communication between tomcat , mysql, because i've written simple java program utilizing same code read same properties file, , connection made successfully.

here things have attempted remedy issue:

  • change owner of properties file (currently owned 'tomcat')
  • ensured user 'root' has been granted privileges in mysql
  • ensured port 3306 (mysql default port) accessible test server
  • updated iptables made various modifications /etc/my.cnf file (tried bind ip, didn't work)

i have hunch issue may related fact trying access mysql database using user 'root'. though i'm accessing via localhost, system may not support because mysql treats access separate host , (maybe?) root access other hosts isn't allowed?

any suggestions on things try appreciated...

i believe issue combination of things.
here items consider fixed me:
- making sure accessing correct app via browser (i using root app, trying connect one)
- making sure user exists in mysql using 'create user ....'
- making sure privileges granted on the database in question, reason granting privileges on . wasn't working me


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -