Mysql – GRANT ROLE TO USER in MySQL

MySQLmysql-5.6permissionsrole

I created one role QI_RO, granted all privileges on all schemas on the server and I was trying to grant role privilege to another user but throwing error.

GRANT QI_RO to test_user@'%';

Error Message:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QI_RO to test_user@'%'' at line 1

DB version:

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.10    |
+-----------+
1 row in set (0.00 sec)

How to grant role privileges to users in Mysql like other databases, Postgres and oracle?

Thanks

Best Answer

It is only supported in mysql 8 https://dev.mysql.com/doc/refman/8.0/en/roles.html