laptop-codeHow to create a read-only MySQL user?

  1. First, login as a MySQL administrator from your terminal / command prompt using the following command:

mysql -u root -p
  1. You’ll prompted to enter the password. Type the password for the root account.

The % in the command above means that user report can be used to connect from any host. You can limit the access by defining the host from where the user can connect. Omitting this information will only allow the user to connect from the same machine.

  1. Grant the SELECT privilege to user.

This command gives the user read-only access to the database from the local host only. If you know the host name or IP address of the host that the collector is will be installed on, type the following command:

  1. Execute the following command to make the privilege changes saved and take effect.

Type quit. Finally, show the granted privileges of user to verify

Last updated