The database is of course created like
create database <database>;
To add the user, one usually uses a command like this in the mysql client shell:
grant all privileges on <database>.* to '<new_user>'@'localhost' identified by '<some_password>';
In which I like to use a randomly generated password (e.g. using makepasswd) for each user.
Besides assigning rights, the latter command also creates <newuser> as a side effect, and even flushes privileges in one fell swoop.
One might further want to prune the granted rights to only work on the actual data, not allowing modification of the tables/schema, but most webapps come with an installer built in that creates/updates the app's tables so this is left as an exercise for the reader.
No comments:
Post a Comment