I've written all of MySQL procedures as root@localhost
:
CREATE DEFINER=`root`@`localhost` PROCEDURE `p_add_user`(...)
Trouble is, when deploying to another server, I have to replace root
with current user and replace localhost
with current IP, which is annoying.
Is there any way to write procedures so that someone who wants to use my database and procedures would not have to modify the definer of each procedure?
As stated in MySQL documentation here
CREATE [DEFINER = { user | CURRENT_USER }] PROCEDURE sp_name ([proc_parameter[,...]]) [characteristic ...] routine_body
So, the DEFINER part is not mandatory, just CREATE PROCEDURE should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With