?
Solved

ava.sql.SQLException: Invalid authorization specification

Posted on 2004-08-31
1
Medium Priority
?
770 Views
Last Modified: 2010-10-05
I am running a testing java program and get the following error message. I have no problem login to mysql with the same username and password. I have tried to connect to the 'test' database without username and password and got no error.
(That means the jdbc driver is working fine.) i have tried to grant all privileges to the user and still got the same error messages. Please help.

===================================================================
java.sql.SQLException: Invalid authorization specification,  message from server: "Access denied for user: 'epuser@interfacezone.net' (Using password: YES)"
================================================================
import java.sql.*;

public class TestMysql
{
  public static void main(String args[]) {
    try {
      /* Test loading driver */

      String driver = "com.mysql.jdbc.Driver";

      System.out.println( "\n=> loading driver:" );
      Class.forName( driver ).newInstance();
      System.out.println( "OK" );

      /* Test the connection */

      String url = "jdbc:mysql://localhost:3306/test";
        String username = "epuser";
      String password = "eppass";
      System.out.println( "\n=> connecting:" );
      DriverManager.getConnection( url, username, password );
      System.out.println( "OK" );
    }
    catch( Exception x ) {
      System.err.println( x );
    }
  }
}
0
Comment
Question by:jeff1919
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 26

Accepted Solution

by:
Umesh earned 800 total points
ID: 11951573
Hi,


>>java.sql.SQLException: Invalid authorization specification,  message from server: "Access denied for user: 'epuser@interfacezone.net' (Using password: YES)"


login using root/any user who has got grant privileges..

GRANT ALL on databasename.* to 'epuse'@'%' identified by 'eppass';

or

GRANT ALL on databasename.* to epuse@'%' identified by 'eppass';
flush privileges;

that's all..

Hope this helps!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question