List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:July 31 1999 1:29am
Subject:Re: mysql table - User/Db tables
View as plain text  
At 21:24, 19990730, 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?

I'm not sure why you're not using the slick GRANT command that works
really nicely, and obviates the need to mess with the privilege tables

>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?

mysql> GRANT ALL PRIVILEGES ON *.* TO elvis IDENTIFIED BY 'grazeland';

That will give elvis (from any host, i.e. host='%') full access (select,
delete, etc.) on every database.  Read up on the GRANT command for all
of the nifty details and some better examples.

If you REALLY want to know how to do it without using the GRANT command,
just use GRANT and then examine what the privilege tables are like
before and after.

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