I need mysql admin_user (not root user) which can create write_user with permissions: CREATE, UPDATE, INSERT, DELETE and SELECT.

admin_user and write_user have access to main_db.

write_user will create user_db and only he can access to that db.

If I want that admin_user can create new user with some permissions, admin_user has to be created "WITH GRANT OPTION" but then he has access to all databases.

Question: How to create mysql user with CREATE USER grant but without access to new databases?

1 Answer 1


With the GRANT command, you can use the ON keyword to set table privileges for users.

For example: GRANT ALL ON user_db to 'write_user'@'localhost'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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