create user dbuser@localhost identified by 'dbpassword';
create database IF NOT EXISTS dbname;
grant all privileges on dbname.* to dbuser@localhost;

User read only

CREATE USER dbuser@localhost IDENTIFIED BY 'dbpassword';
GRANT SELECT ON *.* TO dbuser@localhost