List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 31 1999 1:25pm
Subject:Re: mysql table - User/Db tables
View as plain text  
At 9:24 PM -0400 7/30/99, Elvis wrote:
>I am a little confused on how to setup user/password/DB specific access.
>
>I create a DB.
>
>mysql -ublah -pblah create mydatabase
>
>I then go into mysql
>
>mysql -ublah -pblah mysql
>
>I want to add lines to the User and db table correct?
>
>INSERT INTO user (Host,User,Password,Select_priv...etc) VALUES 
>('localhost','newuser',password('mypass'),'Y'...etc)
>INSERT INTO db (Host,Db,User,Select_priv...etc) VALUES 
>('localhost','mydatabase','newuser','Y'...etc)
>
>then reload the grant tables
>
>mysql -ublah -pblah reload
>
>So, from what I understand from the docs (I must have misread 
>something) is that, newuser can only access the database mydatabase.
>
>However, if I add several of those lines, to different DBs, each 
>user can access other databases.  As in, the user I add in the db 
>table, they are not restricted to that database.
>
>My queston is, how do I do that?
>
>Thanks in advance. :)


Others have mentioned that you really want to use the GRANT command,
but the answer to why your users can access each other's databases
is that you put 'Y' in the user table - those privileges are global
and apply to all databases.  Generally, for regular (non-superuser)
users, you want to put all 'N' privileges in the user table, then grant
database-specific privileges in the db table.

-- 
Paul DuBois, paul@stripped
Thread
mysql table - User/Db tablesElvis31 Jul
  • Re: mysql table - User/Db tablesThimble Smith31 Jul
    • Re: mysql table - User/Db tablesElvis31 Jul
  • mysql table - User/Db tablessinisa31 Jul
  • Re: mysql table - User/Db tablesPaul DuBois31 Jul