Go Back   HTMLCenter Web Development Forums > Web Design and Development > Databases

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-06-2008, 08:31 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,399
Automatically Grant Specific Privileges to all MySQL Users

I am working on a complex site development that utilizes multiple databases. Basically, for each Web form I develop on the site, I need to have a separate database to collect the results. However, there is some information that should remain consistent across all of my Web forms.

I would like to keep that information in a single database.

However, in order to make things a little easier, I would like to find some way to automatically grant SELECT privileges on the specific shared database/tables whenever a new user is created (as I am creating a new user for each database I create, in order to keep one form database user from being able to alter anything in another form database).

Is there any way to write a stored procedure or function to automatically execute the following queries whenever a new user is created?

PHP Code:
GRANT SELECT ON `dbname`.`tablenameTO [specifieduser]@`localhost`
GRANT SELECT ON `dbname`.`table2TO [specifieduser]@`localhost
In the case of this query, "specifieduser" is a variable that should be automatically filled in when the user is created.

Any thoughts?

I am running MySQL 5.0.51a, in case that helps. Thank you.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote

Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Oracle View Into MySQL curtiss Databases 3 06-14-2008 08:32 PM
MySQL help? Will pay. yuppicide Databases 9 06-20-2007 09:57 AM
Add One to an Integer within MySQL field? curtiss Databases 2 08-14-2006 05:54 PM


All times are GMT -5. The time now is 11:07 PM.

 
KickApps
Clicky Web Analytics


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter