List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:May 21 2004 8:02pm
Subject:Re: Copy a mysql user's permissions
View as plain text  
Jim Nachlin wrote:
> Hi List,
> 
> Is there a way to copy a user in the database's mysql database, so that 
> it will have the same permissions (GRANTs) within the database?  Or does 
> one have to create a different user and then manually modify the 
> permissions to match the first?

Warning - untested, but you get the idea...

use mysql;
create temporary table tmp_user select * from user where user='user1' and 
host='host';
update tmp_user set user = 'user2';
insert into user select * from tmp_user;
drop table tmp_user;
create temporary table tmp_db select * from db where db='db' and user='user1' 
and host='host';
update tmp_db set user='user2';
insert into db select * from db;
drop table tmp_db;
flush privileges;

-- 
Sasha Pachev
Create online surveys at http://www.surveyz.com/
Thread
Copy a mysql user's permissionsJim Nachlin21 May
  • Re: Copy a mysql user's permissionsSasha Pachev21 May