SystemMen - This article will show you how to create read-only user in MySQL.
In which case do you need to use user read-only in MySQL? Normally in monitor systems, at the dashboard, you only need to use a read-only user.
This user will read data from the database and display information to the dashboards.
Commands to create a read-only user
You execute the following commands to create a user with
SELECT permission in MySQL.
First, use the following command to create
youruser user with the ip login is
CREATE USER 'youruser'@'localhost' IDENTIFIED BY 'yourpassword';
Next, use the following command to create
youruser user with the ip login as your remote ip. For example, the remote ip is
CREATE USER 'youruser'@'192.168.100.10' IDENTIFIED BY 'yourpassword';
Next, use the following command to grant
SELECT permission (equivalent to read-only) to the user who just created your database.
Recommended Reading: How to install MariaDB 10.3 in Debian 8
GRANT SELECT ON yourdatabase . * TO 'youruser'@'localhost'; GRANT SELECT ON yourdatabase . * TO 'youruser'@'192.168.100.10';
And finally, you use the flush command in mysql to apply a new user.
So you’ve created the read-only user in MySQL. The commands are quite simple but sometimes you won’t remember how to do it. Even I myself.
Hope it will be useful for you at some time.If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.