-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, all --

I am having a bit of trouble with GRANT and users and database access.  I
would like to do two things:

- - Given a system user 'junk' I would like to create a "master" user
  'junk' that can have all permissions (including grant?) on all 'junk_*'
  databases so that he can create and manage his own databases

- - Given a "master" user 'junk' I would like for that user to be able to
  create other users 'junkNN' or or 'junk-*' or whatever so that my good
  friend junk is not always acting as "root".

I have tried

  mysql> grant all privileges on junk_* to [EMAIL PROTECTED] identified by 'junk';
  ERROR 1064: You have an error in your SQL syntax near '* to [EMAIL PROTECTED] 
identified by 'junk'' at line 1
  mysql> grant all privileges on junk_.* to [EMAIL PROTECTED] identified by 'junk';
  Query OK, 0 rows affected (0.24 sec)

and so I guess the way to specify database matching is with pure regexp
notation of '.*' for 'any character any number of times', and my tables
now look like

  mysql> select * from mysql.db where user = 'junk' ;
  | localhost | junk_ | junk | Y           | Y           | Y           | Y           | 
Y           | Y         | N          | Y               | Y          | Y          |
  mysql> select * from mysql.user where user = 'junk' ;
  | localhost | junk | 372b3ff6545565e4 | N           | N           | N           | N  
         | N           | N         | N           | N             | N            | N    
     | N          | N               | N          | N          |

and I can even log in

  bash-2.05a$ mysql -ujunk -pjunk
  Welcome to the MySQL monitor.  Commands end with ; or \g.

but I can't create a database

  mysql> create database junk_testing ;
  ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database 'junk_testing'

OK, I figure, I'll create the DB as root and then get to it as junk, and
work around the problem later.  But that doesn't work, either!

  bash-2.05a$ mysql -u droot -p
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> create database junk_test ;
  Query OK, 1 row affected (0.30 sec)
  mysql> quit;
  Bye
  bash-2.05a$ mysql -ujunk -pjunk
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> use junk_test ;
  ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database 'junk_test'

Maybe I have to re-grant, too.  Grrr...

  bash-2.05a$ mysql -u droot -p
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> grant all privileges on junk_.* to junk ;
  Query OK, 0 rows affected (0.20 sec)
  mysql> quit ;
  Bye
  bash-2.05a$ mysql -ujunk -pjunk
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> use junk_test ;
  ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database 'junk_test'
  mysql> 

OK, now I'm just mad :-)  Let's try granting to this specific database
just to get things going.

  bash-2.05a$ mysql -u droot -p
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> grant all privileges on junk_test to junk ;
  ERROR 1046: No Database Selected
  mysql> use mysql ;
  Database changed
  mysql> grant all privileges on junk_test to junk ;
  Query OK, 0 rows affected (0.02 sec)
  mysql> quit
  Bye
  bash-2.05a$ mysql -ujunk -pjunk
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  mysql> use junk_test ;
  ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database 'junk_test'
  mysql> 

Not only am I a little confused about having had to use a database before
I could grant privs, but it didn't work anyway!

I give up.  Haaaalp! :-)


TIA & HAND

mysql query,
:-D
- -- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE+bQdGGb7uCXufRwARArW+AKDZJ0t9ijYjx3MPK7vtZPjsVPcy3gCfZPlN
voajSct6Bo9nYHBjh/Yip2o=
=U/3l
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to