Copy a mysql user's permissions

2004-05-21 Thread Jim Nachlin
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?

Thanks,
Jim
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Copy a mysql user's permissions

2004-05-21 Thread Sasha Pachev
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/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]