• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

access denied for user ' '@ipaddress in MYSQL

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the following error while connecting to mysql server 4.1 from tomcat 5.0.3 .Tomcat is running in linux and mysql is in a different windows machine.
The problem is the linux IP '172.19.63.57' is shown in the error message instead of the windows IP which is specified in the datasource of struts-config.xml of tomcat in linux.A part of the datasource is as follows

<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property
property="url"
value="jdbc:mysql://172.19.63.199:3306/test?autoReconnect=true" />
<set-property
property="username"
value="root" />
<set-property
property="password"
value="root" />

In the errors below the user is showing as ' ' instead of root.


Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user ''@'172.19.63.57' (using password: NO)'.

** BEGIN NESTED EXCEPTION **

java.sql.SQLException
MESSAGE: Access denied for user ''@'172.19.63.57' (using password: NO)

STACKTRACE:

java.sql.SQLException: Access denied for user ''@'172.19.63.57' (using password: NO)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:750)
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to set up mysql to allow remote connection for any users. The default syntax is:

grant <permission> on <database> to <user>@<location> identified by <password>

eg
grant all on test.* to root@172.19.63.57 identified by root

Will allow 'root' to connect from that IP using that password and give all permissions on all tables in that database.
 
dee sri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks david, it worked!!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fantastic, thanks for getting back to us. I'm still not sure about the ''@IP, but it was worth a shot
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David O'Meara wrote:You need to set up mysql to allow remote connection for any users. The default syntax is:

grant <permission> on <database> to <user>@<location> identified by <password>

eg
grant all on test.* to root@172.19.63.57 identified by root

Will allow 'root' to connect from that IP using that password and give all permissions on all tables in that database.



Thank you, great help. is there a way to specify a mask 172.19.*.* ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic