LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-04-2003, 11:58 PM   #1
stonegold84
Member
 
Registered: Jul 2003
Location: singapore
Distribution: none
Posts: 53

Rep: Reputation: 15
Unhappy mysql problem


hi guyz.......

I have a java program which requires mysql database usage. I have a login part in my program in which the username & passwd is retreived from mysql to verify & to authenticate the user.......

I got the error when i execute the program in the spot where the program connects the database to retrieve the login info....

java.sql.SQLException: Invalid authorization specification: Access denied for user: 'username@127.0.0.1' (Using password: YES)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:659)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562)
at com.mysql.jdbc.Connection.<init>(Connection.java:491)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at MyThread.run(ServerTelnet.java:208)
at java.lang.Thread.run(Thread.java:536)


I asked my friend & in java forum website.. They say that there may be any passwd set to the database... How do i solve this problem?????? any 1 has any idea or any suggestion for this???? The coding which i have did is correct which i verified with my friends.......... I need this to be solved asap.. coz of this my work is being affected .......


any help is appreciated.....


Saravanan
 
Old 09-05-2003, 12:55 AM   #2
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Rep: Reputation: 30
is the server running on localhost, any way you need to grant access to the server to the user before the user can login
 
Old 09-05-2003, 03:09 AM   #3
stonegold84
Member
 
Registered: Jul 2003
Location: singapore
Distribution: none
Posts: 53

Original Poster
Rep: Reputation: 15
hi jayakrishnan,

how do i grant access to the user?????? & how to check whether the server is running???

Thnaxz.
 
Old 09-05-2003, 05:38 AM   #4
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
The server is running cos it's telling you it doesn't want to play.

Is this a database you created yourself?

As said you'll have to look at the grant permissions for the database, maybe if you tell us the database name, the username, the access rights (read/write) you want them to have and where you want to allow them to access from ie. localhost only or any computer we can tell you but beyond that there's not alot more we can do

Also if you try and access using a password and the user doesn't have a password set this error can get thrown up too.

ANd catch that exception
 
Old 09-07-2003, 09:29 PM   #5
stonegold84
Member
 
Registered: Jul 2003
Location: singapore
Distribution: none
Posts: 53

Original Poster
Rep: Reputation: 15
The database name in mysql is saravanan. The table created in this database is USERS. then when i open mysql under ordinary mode i cannot open the database saravanan.

when I open the mysql as root, then i can access the database saravanan.

In the program, i want to access this database from any machine..

(i.e) if i give the username & passwd in machine 1, the machine 2 should be able to check the database for the authentication...


Thanx for the reply.....
.
plz help
 
Old 09-08-2003, 08:50 AM   #6
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Probably the best way to do it is to great a dedicated user for the purpose and grant them the privileges to check the user table i.e


GRANT SELECT on saravanan.USERS TO authorise@'%' IDENTIFIED BY 'some_password_or_other';

FLUSH PRIVILEGES;

This way you are collecting the username and password from the user then logging in as the user authorise to pull the data from the database and match it against the username and password provided by the user.

Authorise will be able to access the database from anywhere that is able to connect to it if this is what you want.


It would be better to create a GRANT statement for every user that requires access to a particular table as then their password and username could be checked directly by mysql without the middle man, if "authorise" password is compromised then all passwords and usernames could be too, but as I'm not completely sure the purpose of checking the name and password held in a table I'll leave it at that and hopefully it's some help.

Last edited by Looking_Lost; 09-08-2003 at 08:52 AM.
 
Old 09-08-2003, 09:28 PM   #7
stonegold84
Member
 
Registered: Jul 2003
Location: singapore
Distribution: none
Posts: 53

Original Poster
Rep: Reputation: 15
hi thanxz for the valuable reply///////

GRANT SELECT on saravanan.USERS TO authorise@'%' IDENTIFIED BY 'some_password_or_other';

FLUSH PRIVILEGES;


Is this the command which i should type???

can u give the full command to be typed ????

should it be typed as a root in mysql????

thanxz....
 
Old 09-08-2003, 11:53 PM   #8
stonegold84
Member
 
Registered: Jul 2003
Location: singapore
Distribution: none
Posts: 53

Original Poster
Rep: Reputation: 15
hii
grant select on saravanan.USERS to sara;
Query OK, 0 rows affected (0.11 sec)

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

I get this when i execute the command... wat to do for this???

thanxz.......

Saravanan
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugzilla - MySQL - perl - DBD::mysql install problem Runningonair Linux - Software 8 10-12-2007 01:42 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
mysql 4.0.24 to mysql 4.1.12 upgrade problem tuxrules Slackware 7 08-13-2005 07:43 PM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 10:46 AM
MySQL mysql-3.23.56-1.9, rpm install problem jacsmith510 Linux - Newbie 3 09-19-2003 03:02 PM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration