0

Is it possible in mysql to create user who is able to create database, user and grant all privileges on this database to that user?I dont want to use root user in script

0

There is nothing special about "root".

CREATE USER foo@localhost ...;   -- establish the existence and pwd of the user
GRANT CREATE DATABASE     -- so foo can do CREATE DATABASE
      ...                 -- and other things (as needed)
    ON *.*                -- probably have to give permission at this level
    TO foo@localhost      -- the user
    WITH GRANT OPTION;    -- so foo can do GRANTs

See also SUPER -- decide whether or not you want this non-user to have all the privileges it entails.

For security reasons, only @localhost should be used with WITH GRANT OPTION.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.