I'm writing a small deployment SQL script for my first database-driven app.
In the process, I find that I repeat myself a lot, for instance:
GRANT USAGE ON *.* TO 'foo'@'localhost';
DROP USER 'foo'@'localhost';
CREATE USER 'foo'@'localhost' IDENTIFIED BY 'password';
It would be fantastic if I could use a variable or a macro to replace commonly occurring data. Is it possible to implement something like the the following snippet?
#define USER 'foo' #or "Type USER = 'foo'"
#define HOST 'localhost' #or "Type HOST = 'localhost'"
GRANT USAGE ON *.* TO USER@HOST
DROP USER USER@HOST
CREATE USER USER@HOST IDENTIFIED BY 'password'