PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > mysql.general > user permissions to all DB
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
user permissions to all DB

Réponse
 
LinkBack Outils de la discussion
Vieux 20/08/2007, 21h24   #1
Terry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut user permissions to all DB

Hello,

I want to grant a user all permissions to all DBs on the system as
well as any new DBs that show up. I want to avoid having to modify
permissions everytime a new DB is added. Is there a way to do this?

Thanks!
  Réponse avec citation
Vieux 20/08/2007, 21h41   #2
Jay Pipes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

Terry wrote:
> Hello,
>
> I want to grant a user all permissions to all DBs on the system as
> well as any new DBs that show up. I want to avoid having to modify
> permissions everytime a new DB is added. Is there a way to do this?


GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
IDENTIFIED BY 'password';

Cheers,

Jay
  Réponse avec citation
Vieux 20/08/2007, 21h47   #3
Terry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

Just to verify, will that include all new databases?

On 8/20/07, Jay Pipes <jay@mysql.com> wrote:
> Terry wrote:
> > Hello,
> >
> > I want to grant a user all permissions to all DBs on the system as
> > well as any new DBs that show up. I want to avoid having to modify
> > permissions everytime a new DB is added. Is there a way to do this?

>
> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
> IDENTIFIED BY 'password';
>
> Cheers,
>
> Jay
>

  Réponse avec citation
Vieux 20/08/2007, 21h48   #4
Jay Pipes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

Yep.

Terry wrote:
> Just to verify, will that include all new databases?
>
> On 8/20/07, Jay Pipes <jay@mysql.com> wrote:
>> Terry wrote:
>>> Hello,
>>>
>>> I want to grant a user all permissions to all DBs on the system as
>>> well as any new DBs that show up. I want to avoid having to modify
>>> permissions everytime a new DB is added. Is there a way to do this?

>> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
>> IDENTIFIED BY 'password';
>>
>> Cheers,
>>
>> Jay
>>


  Réponse avec citation
Vieux 20/08/2007, 22h07   #5
Rolando Edwards
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

You must be very careful when granting permissions on every database this way.

Here is why:

By giving a user permissions on all databases this way,
you also give away permissions to the 'mysql' schema.
This is where the grant tables live.

A person could
1) insert new users into mysql.user like this
INSERT INTO mysql.user VALUES (...);

2) delete users from mysql.user like this
DELETE FROM mysql.user WHERE host='...' AND user='...';

3) maliciously or accidently change passwords like this
UPDATE mysql.user SET PASSWORD=PASSWORD('<insert new password>') WHERE host='...' AND user='...';

4) grants additional privileges to himself like this
UPDATE mysql.user SET grant_priv='Y',execute_priv='Y',... WHERE host='...' AND user='...';

After setting those privilges, the person would then run "FLUSH PRIVILEGES;"
Then, all the privileges the user gave himself would go into effect !!!
Of course, the user would need the RELOAD privilege to do "FLUSH PRIVILEGES;"

Even if the user does not have RELOAD privilege, the user could still give himself this privilege in a delayed way like this
UPDATE mysql.user SET reload_priv='Y' WHERE host='...' AND user='...';

Then the next time mysqld is restarted, all the privileges the user gave himself would go into effect !!!

It is therefore NOT RECOMMENDED the user be granted privileges over the 'mysql' schema.

Instead to this:
GRANT SELECT, INSERT, CREATE, ... ON db1.* TO 'username'@'hostname' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, CREATE, ... ON db2.* TO 'username'@'hostname' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, CREATE, ... ON db3.* TO 'username'@'hostname' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, CREATE, ... ON db4.* TO 'username'@'hostname' IDENTIFIED BY 'password';

Grant the necessary privileges to each database individually and leave out 'mysql'.

Unfortunately, you cannot grant privileges to all databases and revoke privileges from one schema ('mysql' in this instance)
You must enumerate the databases you specifically want to grant the user privileges to.

GUARD THE mysql SCHEMA WITH YOUR LIFE, PLEASE !!!!

----- Original Message -----
From: "Jay Pipes" <jay@mysql.com>
To: "Terry" <td3201@gmail.com>
Cc: mysql@lists.mysql.com
Sent: Monday, August 20, 2007 3:41:52 PM (GMT-0500) America/New_York
Subject: Re: user permissions to all DB

Terry wrote:
> Hello,
>
> I want to grant a user all permissions to all DBs on the system as
> well as any new DBs that show up. I want to avoid having to modify
> permissions everytime a new DB is added. Is there a way to do this?


GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
IDENTIFIED BY 'password';

Cheers,

Jay

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=redwards@swmx.com



--
Rolando A. Edwards
MySQL DBA

SWMX, Inc.
1 Bridge Street
Irvington, NY 10533
(914) 406-8406 (Main)
(201) 660-3221 (Mobile)

  Réponse avec citation
Vieux 20/08/2007, 22h21   #6
Jay Pipes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

Terry,

I absolutely agree with Rolando on this.

Rolando,

Although I agree with you, I was only trying to answer Terry's question

Cheers,

Jay

Rolando Edwards wrote:
> You must be very careful when granting permissions on every database this way.
>
> Here is why:
>
> By giving a user permissions on all databases this way,
> you also give away permissions to the 'mysql' schema.
> This is where the grant tables live.
>
> A person could
> 1) insert new users into mysql.user like this
> INSERT INTO mysql.user VALUES (...);
>
> 2) delete users from mysql.user like this
> DELETE FROM mysql.user WHERE host='...' AND user='...';
>
> 3) maliciously or accidently change passwords like this
> UPDATE mysql.user SET PASSWORD=PASSWORD('<insert new password>') WHERE host='...' AND user='...';
>
> 4) grants additional privileges to himself like this
> UPDATE mysql.user SET grant_priv='Y',execute_priv='Y',... WHERE host='...' AND user='...';
>
> After setting those privilges, the person would then run "FLUSH PRIVILEGES;"
> Then, all the privileges the user gave himself would go into effect !!!
> Of course, the user would need the RELOAD privilege to do "FLUSH PRIVILEGES;"
>
> Even if the user does not have RELOAD privilege, the user could still give himself this privilege in a delayed way like this
> UPDATE mysql.user SET reload_priv='Y' WHERE host='...' AND user='...';
>
> Then the next time mysqld is restarted, all the privileges the user gave himself would go into effect !!!
>
> It is therefore NOT RECOMMENDED the user be granted privileges over the 'mysql' schema.
>
> Instead to this:
> GRANT SELECT, INSERT, CREATE, ... ON db1.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db2.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db3.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db4.* TO 'username'@'hostname' IDENTIFIED BY 'password';
>
> Grant the necessary privileges to each database individually and leave out 'mysql'.
>
> Unfortunately, you cannot grant privileges to all databases and revoke privileges from one schema ('mysql' in this instance)
> You must enumerate the databases you specifically want to grant the user privileges to.
>
> GUARD THE mysql SCHEMA WITH YOUR LIFE, PLEASE !!!!
>
> ----- Original Message -----
> From: "Jay Pipes" <jay@mysql.com>
> To: "Terry" <td3201@gmail.com>
> Cc: mysql@lists.mysql.com
> Sent: Monday, August 20, 2007 3:41:52 PM (GMT-0500) America/New_York
> Subject: Re: user permissions to all DB
>
> Terry wrote:
>> Hello,
>>
>> I want to grant a user all permissions to all DBs on the system as
>> well as any new DBs that show up. I want to avoid having to modify
>> permissions everytime a new DB is added. Is there a way to do this?

>
> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
> IDENTIFIED BY 'password';
>
> Cheers,
>
> Jay
>


  Réponse avec citation
Vieux 21/08/2007, 04h23   #7
Rolando Edwards \
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

OK. I am just a little pumped up these days.
I just passed my Certification Exams.
Chapter 34 of the Certification Book is still fresh in my mind.

Even though I'm in the US, Cheers everybody !!!


Jay Pipes <jay@mysql.com> wrote:
Terry,

I absolutely agree with Rolando on this.

Rolando,

Although I agree with you, I was only trying to answer Terry's question

Cheers,

Jay

Rolando Edwards wrote:
> You must be very careful when granting permissions on every database this way.
>
> Here is why:
>
> By giving a user permissions on all databases this way,
> you also give away permissions to the 'mysql' schema.
> This is where the grant tables live.
>
> A person could
> 1) insert new users into mysql.user like this
> INSERT INTO mysql.user VALUES (...);
>
> 2) delete users from mysql.user like this
> DELETE FROM mysql.user WHERE host='...' AND user='...';
>
> 3) maliciously or accidently change passwords like this
> UPDATE mysql.user SET PASSWORD=PASSWORD('') WHERE host='...' AND user='...';
>
> 4) grants additional privileges to himself like this
> UPDATE mysql.user SET grant_priv='Y',execute_priv='Y',... WHERE host='...' AND user='...';
>
> After setting those privilges, the person would then run "FLUSH PRIVILEGES;"
> Then, all the privileges the user gave himself would go into effect !!!
> Of course, the user would need the RELOAD privilege to do "FLUSH PRIVILEGES;"
>
> Even if the user does not have RELOAD privilege, the user could still give himself this privilege in a delayed way like this
> UPDATE mysql.user SET reload_priv='Y' WHERE host='...' AND user='...';
>
> Then the next time mysqld is restarted, all the privileges the user gave himself would go into effect !!!
>
> It is therefore NOT RECOMMENDED the user be granted privileges over the 'mysql' schema.
>
> Instead to this:
> GRANT SELECT, INSERT, CREATE, ... ON db1.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db2.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db3.* TO 'username'@'hostname' IDENTIFIED BY 'password';
> GRANT SELECT, INSERT, CREATE, ... ON db4.* TO 'username'@'hostname' IDENTIFIED BY 'password';
>
> Grant the necessary privileges to each database individually and leave out 'mysql'.
>
> Unfortunately, you cannot grant privileges to all databases and revoke privileges from one schema ('mysql' in this instance)
> You must enumerate the databases you specifically want to grant the user privileges to.
>
> GUARD THE mysql SCHEMA WITH YOUR LIFE, PLEASE !!!!
>
> ----- Original Message -----
> From: "Jay Pipes"
> To: "Terry"
> Cc: mysql@lists.mysql.com
> Sent: Monday, August 20, 2007 3:41:52 PM (GMT-0500) America/New_York
> Subject: Re: user permissions to all DB
>
> Terry wrote:
>> Hello,
>>
>> I want to grant a user all permissions to all DBs on the system as
>> well as any new DBs that show up. I want to avoid having to modify
>> permissions everytime a new DB is added. Is there a way to do this?

>
> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
> IDENTIFIED BY 'password';
>
> Cheers,
>
> Jay
>



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=r..._dba@yahoo.com




---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.
  Réponse avec citation
Vieux 21/08/2007, 04h51   #8
solidzh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

2007/8/21, Jay Pipes <jay@mysql.com>:
> Terry wrote:
> > Hello,
> >
> > I want to grant a user all permissions to all DBs on the system as
> > well as any new DBs that show up. I want to avoid having to modify
> > permissions everytime a new DB is added. Is there a way to do this?

>
> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
> IDENTIFIED BY 'password';
>


That's well but why not,
grant all on *.* to 'user'@'host' identified by 'pwd'; ?
  Réponse avec citation
Vieux 21/08/2007, 17h16   #9
Jay Pipes
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: user permissions to all DB

solidzh wrote:
> 2007/8/21, Jay Pipes <jay@mysql.com>:
>> Terry wrote:
>>> Hello,
>>>
>>> I want to grant a user all permissions to all DBs on the system as
>>> well as any new DBs that show up. I want to avoid having to modify
>>> permissions everytime a new DB is added. Is there a way to do this?

>> GRANT SELECT, INSERT, CREATE, ... ON *.* TO 'username'@'hostname'
>> IDENTIFIED BY 'password';
>>

>
> That's well but why not,
> grant all on *.* to 'user'@'host' identified by 'pwd'; ?


Because then you give the user SUPER, FILE, ALTER, SHUTDOWN, and PROCESS
privileges, which probably isn't a good idea...

Cheers,

Jay
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 04h26.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16989 seconds with 17 queries