This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 149824 - Grant full access to user does not seem to work during db creation
Summary: Grant full access to user does not seem to work during db creation
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: MySQL (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P2 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-10 22:27 UTC by jbolter
Modified: 2008-12-11 22:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jbolter 2008-10-10 22:27:33 UTC
I have tested this on MacOS X 10.5 and Windows XP in Virtual Box using the 6.5 nightly build (200810080201).  Here are
the steps I take.

Connect to the MySQL database as root.  This works fine.  I see all the databases.  I create a user using a SQL
statement, works fine, i see the new user in the mysql.user table.  Now I right click the MySQL Server and choose Create
Database. I enter the new database name and check the box to Grant Full Access To: phpuser@localhost.  The database gets
created but I do not have any permissions for phpuser@localhost.  The connection is opened as root which works fine but
the permissions for phpuser@localhost are never added to the mysql.db table.
Comment 1 David Vancouvering 2008-10-15 01:04:25 UTC
This is no good - we should either remove this feature or make it work correctly.
Comment 2 David Vancouvering 2008-10-29 19:28:18 UTC
Discussing with HIE/docs to see if I can remove support for the Grant User feature...
Comment 3 David Vancouvering 2008-10-30 21:10:14 UTC
I just tried this and it worked fine for me as davidvc@localhost.  I did a select of mysql.db where db = 'test' and I
saw myself there, with all privileges.

Here is the command I send to the server:

GRANT ALL ON dbname.* TO ?.?

and then substitute the two parameters for the user name and host name derived from the drop-down.

I wonder what's different.  What version of MySQL are you using?  I am using 5.0.41 on Mac.

I can't seem to find any mention of any way to log the SQL being sent to the MySQL server.  There is a logging JDBC
driver at http://log4jdbc.sourceforge.net/ that we could use to see what exactly is being sent if necessary...

Can you please try again and describe the exact steps you are using? Then remove the INCOMPLETE keyword as I filter out
issues marked as incomplete.

Thanks!
Comment 4 jbolter 2008-10-30 23:40:15 UTC
I tried it again thinking that maybe the issue was because I have a blank root password. So I set a root password and
tried again and still did not get the result I was hoping for.  Here are the exact steps I took.

Go to Services window.
Right click MySQL server, choose Connect.
Right click MySQL server again, choose Create Database.
Enter database name 'testdb' and check box to grant full permission to: selected phpuser@localhost.
Click OK.
Database is created and NB makes a connection using the root account.
If I view mysql.db I do not see any permissions for phpusers@localhost for database testb.
Just to make sure I try to create a connection using the phpuser account and it fails to authenticate.

I am using NB RC1, Mac OS 10.5, and MySQL Server version: 5.0.51b MySQL Community Server (GPL).

Comment 5 David Vancouvering 2008-10-31 00:03:49 UTC
Sigh... Thanks.
Comment 6 David Vancouvering 2008-10-31 00:25:16 UTC
That's weird.  I just tried it again, using the database name 'newdb' and this time when I did a 'select * from
mysql.db' the database 'newdb' wasn't even there.  But of course it is there because I'm connected to it.  I did try to
connect as davidvc and it failed, although I was able to connect as root.

What's even stranger is that there are databases in mysql.db that I deleted long ago.

Then I did a "grant all on newdb.* to davidvc@localhost" and executed that and then I was able to connect.

So now I'm very confused.
Comment 7 David Vancouvering 2008-10-31 00:27:27 UTC
Oh, I get it, if nobody but root has privileges on a table, then it doesn't show up in mysql.db.  mysql.db is a
privileges table, it's not the metadata for the table definition itself.

So, I guess I just got lucky this time, now I can reproduce and I will investigate.
Comment 8 David Vancouvering 2008-10-31 23:04:09 UTC
Well, it would help if we actually *called* the method to grant access to the user. Doh!  The programming equivalent of
"is it plugged in?" :)
Comment 9 David Vancouvering 2008-10-31 23:34:30 UTC
2864c04e06b0
Comment 10 Quality Engineering 2008-11-01 05:13:54 UTC
Integrated into 'main-golden', will be available in build *200811010201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2864c04e06b0
User: David Van Couvering <davidvc@netbeans.org>
Log: #149824: Grant full access to user does not seem to work during db creation
Comment 11 Roman Mostyka 2008-11-05 20:01:40 UTC
jbolter, can You verify with latest build that this issue was really fixed?
Comment 12 David Vancouvering 2008-11-05 20:52:52 UTC
He talked to me offline, it's verified.
Comment 13 jbolter 2008-11-05 20:59:10 UTC
Yes it is verified, thanks guys!
Comment 14 rbalada 2008-11-18 13:47:32 UTC
I've transplanted the changeset http://hg.netbeans.org/main/rev/2864c04e06b0 into release65_fixes repository as
http://hg.netbeans.org/release65_fixes/rev/977e8c36470c