I have an adduser script that will add a list of any given users to a redhat 9 box. I am trying it write a script that can be called from within the add user script to add a database and database username for each user.
I cannot figure out how to pass the variables and be able to output the commands to mysql. The mysql commands i want to run are:
CREATE DATABASE test;
GRANT USAGE ON * . * TO test_user@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON test` . * TO test_user@localhost;
Subbing the proper username and databse name.
So i need a script that you can run by:
bash# ./mysqladd.script username databasename userpassword
Any hints on how to accomplish this?
Thanks,
I cannot figure out how to pass the variables and be able to output the commands to mysql. The mysql commands i want to run are:
CREATE DATABASE test;
GRANT USAGE ON * . * TO test_user@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON test` . * TO test_user@localhost;
Subbing the proper username and databse name.
So i need a script that you can run by:
bash# ./mysqladd.script username databasename userpassword
Any hints on how to accomplish this?
Thanks,