I have some troubles with GRANT and variables together in MySql.
SET @username := 'user123', @pass := 'pass123';
GRANT USAGE ON *.* TO @username@'%' IDENTIFIED BY @pass;
GRANT INSERT (header1, header2, headern) ON `data` TO @username@'%';
GRANT SELECT (header1, header2) ON `data2` TO @username@'%';
I'd like to put username and password into variables at the begining of the script and then later use them in GRANT
So instead of this:
GRANT USAGE ON *.* TO 'user123'@'%' IDENTIFIED BY 'pass123';
I'd like to use something like this:
GRANT USAGE ON *.* TO @username@'%' IDENTIFIED BY pass;
I'd really appreciate, if someone could show me the proper statements. Thank you in advence!