Collections:
Giving User Read-only Access in MySQL
How To Give a User Read-Only Access to a Database in MySQL?
✍: FYIcenter.com
If you want give a user read-only access to a database, you can grant to him/her only the "SELECT" privilege, so that he/she can not run any DDL statements, and any INSERT, UPDATE, or DELETE statements. The tutorial exercise gives you a good example:
>cd \mysql\bin >mysql -u root -pretneciyf mysql> USE fyi; Database changed mysql> CREATE TABLE links (id INTEGER, name VARCHAR(80)); Query OK, 0 rows affected (0.14 sec) mysql> INSERT INTO links VALUES (1, 'dba.fyicenter.com'); Query OK, 1 row affected (0.05 sec) mysql> CREATE USER guest IDENTIFIED BY 'pub'; Query OK, 0 rows affected (0.24 sec) mysql> GRANT SELECT ON fyi.* TO guest; Query OK, 0 rows affected (0.00 sec) mysql> QUIT; >mysql -u guest -ppub mysql> use fyi; Database changed mysql> SELECT * FROM links; +------+-------------------+ | id | name | +------+-------------------+ | 1 | dba.fyicenter.com | +------+-------------------+ 1 row in set (0.04 sec) mysql> INSERT INTO links VALUES (2, 'dev.fyicenter.com'); ERROR 1142 (42000): INSERT command denied to user 'guest'@'localhost' for table 'links'
⇒ User Privilege Tables in MySQL
⇐ Revoking User Privileges in MySQL
2017-08-21, 2229🔥, 0💬
Popular Posts:
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS) in SQL Server? Process sqlservr.exe is the...
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
How To Convert Binary Strings into Integers in SQL Server Transact-SQL? Binary strings and integers ...
How To Verify a User name with SQLCMD Tool in SQL Server? The quickest way to verify a user name in ...