MySQL Forums
Forum List  »  Newbie

Re: Create user in a Stored Procedure
Posted by: Peter Brawley
Date: October 08, 2015 11:56AM

> The application will have a user table containing all the usual information.
> I don't want the table to contain passwords,

Why not?

> rather I am thinking of letting the database handle that for me.

Eh? Your table can only exist in a database.

> So, I want to create a stored procedure

You show a function, not a stored procedure. Big difference---sprocs can do much that funcs cannot, see the manual.

> that will add to my user table and create a db user and grant privileges for that user

Sorry, terrible idea. Your app should use a predefined user, or multiple such users if the app needs different privilege sets (eg guest, user, admin). Those predefined users will be defined in the mysql.user table, and perhaps if necessary, other mysql privilege tables. Your app should never write to mysql privilege tables---only DBAs should be doing that, and presumably the only relevant DBA for your app is you unless you're using some other organisation's MySQL server.



Edited 1 time(s). Last edit at 10/08/2015 04:05PM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
Re: Create user in a Stored Procedure
October 08, 2015 11:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.