Solved

Mysql permissions

Posted on 2011-09-26
14
183 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
Comment Utility

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
Comment Utility

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
Comment Utility
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
 
LVL 47

Expert Comment

by:for_yan
Comment Utility

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

Author Comment

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

Expert Comment

by:CEHJ
Comment Utility
>>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
Comment Utility
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
'connected' should be 'connecting'
0
 

Author Closing Comment

by:sargent240
Comment Utility
A couple of good hands!
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:)
0
 

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now