September 5, 2020

Create a Read Only MySQL User

There are times when you need account read only access to a database.

To create a read only database user MySQL, do the following steps:

  1. Login as a MySQL administrator.

  2. Create a new MySQL user account.

>>> CREATE USER 'dapenda'@'%' IDENTIFIED BY 'mypassword';
  1. Grant the SELECT only privilege to user.
>>> GRANT SELECT ON site.* TO 'dapenda'@'%';
  1. Reload grant privilege for re-read access table MySQL.
>>> FLUSH PRIVILEGES;
  1. Done.