Solved

Mysql permissions

Posted on 2011-09-26
14
209 Views
Last Modified: 2012-06-27
When I execute my program I get the  mysql error

Connect Database SQLException: Access denied for user 'user'@'localhost' (using password:YES)

The only way I can run the program is as root and I would like to run it as a regular user
0
Comment
Question by:sargent240
  • 6
  • 5
  • 3
14 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36625399

The databse administrator needs to create a schema for you and you should know user and password
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 200 total points
ID: 36626942

The command should be something like that:
CREATE USER 'test'@'localhost' IDENTIFIED BY 'your_password';
read this:
http://www.iis-aid.com/articles/how_to_guides/creating_a_mysql_user_via_the_command_line
0
 

Author Comment

by:sargent240
ID: 36646194
yan: I logged on as root, brought up mysql, and executed the command you suggested.  I then enter the command

SELECT user FROM mysql.user;

and got the following list

al
root
root

root

al root

The list appears exactly like it appeared on my computer including the blank lines.  I redid the passwords and the problem still appears.
Any thoughts?  Thankss
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 47

Expert Comment

by:for_yan
ID: 36649402

can you login to your mysql database atthe command line - try to login as different user
not as root
0
 

Author Comment

by:sargent240
ID: 36667116
when I try to log in as anything but root I get an access denied error.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36708260
>>when I try to log in as anything but root I get an access denied error.

Please post the command you used
0
 

Author Comment

by:sargent240
ID: 36709624
At the command line prompt I simply type:

mysql

and hit the enter key.  If I do it as root I get the mysql prompt, if I do it as another user I get the error.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36709708
Try this command as another user - it should prompt you for that user's password
mysql -u anotheruser -p

Open in new window

0
 

Author Comment

by:sargent240
ID: 36710078
Your suggested command allows me to access mysql from the prompt as a user other than root.  As you can see from my original post my ultimate problem is getting an access denied error when executing my application.  That problem still exists.  Any ideas?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 300 total points
ID: 36711160
Are you connected to the db from the same host as the one on which the db is running?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36711167
'connected' should be 'connecting'
0
 

Author Closing Comment

by:sargent240
ID: 36711333
A couple of good hands!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36711659
:)
0
 

Author Comment

by:sargent240
ID: 36711726
Don't know what to think of your last post CEHJ
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Android development question 2 55
String array comparison 4 38
ejb entity bean example issue 2 18
Is there a simpler dropbox system? 10 35
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

820 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