Run MySQL

Open MySQL using the below command. The username should be your root user or an admin user with access for creating other users.

1
2
mysql -u username -p
# Enter password when asked 

Create a database and a user

Create a new database (if required) and create a new user. Grant permissions to the database for the user.

1
2
3
4
create database dbname;
create user 'dbusername'@'locahost' identified by 'dbpassword';
grant all privileges on dbname.* to 'dbusername'@'locahost';
flush privileges;