LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-21-2003, 04:47 PM   #1
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Rep: Reputation: 15
Question Regarding MySQL


Hi there...

Hoping someone more experienced than I with MySQL can point out where I am going wrong....

I am trying to set up a database that I can access programatically via MySQL++. Each time I try to access it though, I get the following error:

Quote:
Error: Access denied for user: 'myuser@localhost' (Using password: YES)

I logged into the mysql client as root, created the database and created the userss, myuser with the following command:

Quote:
grant all privileges on mydatabase.* to myuser@localhost identified by 'mypassword';
then I did a select query to make sure it was right and the permissions were all 'N'... shouldn't they have been 'Y' ?

I then executed:
Quote:
flush privileges;
but this didn't change anything. So I fell back to my window's experiences and rebooted *shrug* didn't help however.

So I re-entered the client and manually changed the permissions to 'Y' with an update query and flushed again, but still no dice.

I also added this user a second time as 'myuser@my.dns.com' with the same permissions, but I am still told that I cannot access via localhost.

Would anyone be so kind as to tell me what it is that I am doing wrong?

Thanks in advance

Verbal

p.s. forgot to mention: this is a RH9 text only install
and, I CAN connect with this user from commandline.

Last edited by verbal; 10-21-2003 at 05:17 PM.
 
Old 10-21-2003, 04:49 PM   #2
xwastedmindx
Member
 
Registered: Jun 2003
Location: Florida
Distribution: Mandrake 9.1
Posts: 43

Rep: Reputation: 15
I could be wrong.. but I believe you have to give the user(s) database access permissions.

you can do this via Webmin or any other administration tool.
 
Old 10-21-2003, 05:08 PM   #3
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by xwastedmindx
I could be wrong.. but I believe you have to give the user(s) database access permissions.

you can do this via Webmin or any other administration tool.
I'll hit the MySQL documents again...at least I have something in particular to look for this time :)

Thanks for the help

Verbal
 
Old 10-22-2003, 06:39 AM   #4
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
Hi there...

Maybe I am getting old, but I spent the night re-reading the docs and experimenting with this issue and could not find anything in the manual that suggests that I need seperate access permissions beyond what the grant table entry offers.

also, I am still wondering if:

grant all privileges on mydatabase.* to myuser@localhost identified by 'mypassword';


should be leaving all the permission values set to 'N'...this doesn't seem right to me, especially after having re-read everything.

Does anyone have any other ideas? I really need the help on this one, this is for a CGI, and rolling my own data structures in a stateless environment isn't too attractive of an alternative.

Thanks

Verbal
 
Old 10-22-2003, 06:46 AM   #5
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
You said that you could log into mysql from command line? that means that the use is setup, whether it is right or not I won't say for now.

Have you tried setting up a database like "test_database" and granting full privileges to your test user to the "test_database" then log in to the mysql database command line and do a:

use test_database;
show tables;

It will of course show no tables but if it does that without errors then you have a database that you know your user can access then you could try working off from that test database with your MySQL++ stuff
 
Old 10-22-2003, 06:58 AM   #6
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by cli_man
Have you tried setting up a database like "test_database" and granting full privileges to your test user to the "test_database" then log in to the mysql database command line and do a:

use test_database;
show tables;

Yes...I can access the test database from commandline, I was also able to populate it with tables with:

> mysql -umyuser -p mydatabase < my.setup.script

the script being nothing more than a bunch of table creation SQL statements. I could then log in and add some data with SQL inserts.

as soon as I try to execute code from the shell however, I am right back to access denied for myuser@localhost... argh!

My only experience with this setup was on an HP UX a long time ago, so I am really out of my depth here.

thanks for the advice

Verbal
 
Old 10-22-2003, 07:06 AM   #7
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Ok then your permissions are good enought to do what you are wanting, Are using the password when you try executing code from commandline? if so try just as a test getting rid of the password for myuser@localhost so you can log in without a password. Also try again as a test to execute code as root@localhost and see if that will work.

What is it that you are trying to run at the command line? Could it be a problem specific to that program?
 
Old 10-22-2003, 07:15 AM   #8
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
Hi again...

I'll try running as root, hadn't thought of that damn...I _AM_ getting old.

All I am attempting to right now is refamiliarize myself with the API, has been a couple years since I last worked with it... so esentially just running test examples from the MySQL++ manual...simple things like returning SELECT query results, etc.

I have to run to work, will test as root later today and re-post results, thanks for all your help, it is greatly appreciated!

Verbal
 
Old 10-22-2003, 07:18 AM   #9
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
I get enought help on these boards myself that it is nice to try and help out where I can. Also sometimes it helps to have someone point out the little things you have overlooked or forgotton :-)
 
Old 10-22-2003, 11:07 AM   #10
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
Hi there...

You were right on the money...running the code using the MySQL root user worked perfectly, which would suggest a permissions issue within the grant tables correct?

If so, then I am in an all new quandry, because I am pretty sure I did that right (my steps are refrenced in the posts above).

the command I used:

grant all privileges on mydatabase.* to myuser@localhost identified by 'mypassword';

has left me with questions, as the grant permissions were set to 'N' even though I specified 'all' in the grant command.... even after flushing.

thanks

Verbal
 
Old 10-22-2003, 11:27 AM   #11
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Well here is the command straight out of the MySQL Reference site on mysql.com

GRANT ALL ON database.* TO user@localhost IDENTIFIED BY "password"

It is just a little different then what you have, I always to my permissions from webmin so I cannot help you with that but maybe that will help.

http://www.mysql.com/doc/en/GRANT.html
 
Old 10-22-2003, 01:59 PM   #12
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
so they drop the word "privileges"... thats worth a shot

I'll try it out after work.

Thanks for all the help!

Verbal
 
Old 10-23-2003, 06:59 AM   #13
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Original Poster
Rep: Reputation: 15
fianl solution

Just a final follow up...

it turns out that "myuser@localhost" isn't enough for the grant tables, I had to also add "myuser@localhost.localdomain",
with this last addition to the grant tables I was able to finally connect with myuser.



Thanks so much for all your help!!

Verbal
 
  


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
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
MySQL question... kith Linux - General 3 03-06-2004 06:40 PM
MySQL Question NoBrains Linux - Software 2 03-01-2004 10:10 PM
MySQL question TraCe66 Linux - Newbie 11 07-15-2003 02:35 PM
MySQL question ascii2k Linux - General 1 03-27-2002 04:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:14 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
Open Source Consulting | Domain Registration