How to Create Database and Add User To It

Here are the SQL commands:

create database newdb;

grant CREATE,INSERT,DELETE,UPDATE,SELECT on newdb.* to newuser@localhost;

SET PASSWORD FOR 'newuser'@'localhost' = password(’newuserpass’);
– or –
SET PASSWORD FOR 'newuser'@'localhost' = old_password(’newuserpass’);

flush privileges;

Leave a comment