Copy permissions from one role to another using Mysql only

Public
</> CopyGet raw version
sql
  1. CREATE TEMPORARY TABLE tmp SELECT * FROM role_permission WHERE rid = %source_rid%;
  2. UPDATE tmp SET rid = %destination_rid% WHERE rid = %source_rid%;
  3. INSERT INTO role_permission SELECT * FROM tmp WHERE rid = %destination_rid%;
  4. DROP TABLE tmp;