To create a user in mysql with readonly access, following is the useful command.
Login with root access and use following commands.
CREATE USER 'use'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;