MySQL复制用户 [英] MySQL copy a user

查看:217
本文介绍了MySQL复制用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MySQL测试数据库上创建两个用户,一个用户对与生成报告相关的表具有只读访问权限,等等,另一个对同一表具有读写访问权限.这用于测试通常与只读用户连接但切换至读写用户以执行某些任务的子系统.我已经使用正确的权限创建了读写用户,现在我需要同一用户的只读版本.

I want to create two users on my MySQL test database, One with read-only access to tables relevant to generating reports, etc, the other with read-write access to the same tables. This is for testing a subsystem that normally connects with a read-only user but switches to a read-write user for certain tasks. I've created the read-write user with the correct privileges, and now I need a read-only version of the same user.

我不想从头开始创建只读版本,因为我必须设置很多特权,这非常费力.有没有一种方法可以基于现有用户创建新用户,然后从新用户中删除INSERT/UPDATE/DELETE特权?像CREATE USER 'user2' LIKE 'user1'之类的东西?如果可以的话,我无法在MySQL文档中找到它.

I'd rather not create the read-only version from scratch as I had to set a lot of privileges, which was rather laborious. Is there a way I can create a new user based on an existing user and then remove the INSERT/UPDATE/DELETE privilages from the new user? Something like CREATE USER 'user2' LIKE 'user1' or similar? I couldn't find it in the MySQL docs if it is possible to do this.

推荐答案

我发现了两个选择.

第一,如果您是Windows用户,则可以使用MySql Administrator. http://dev.mysql.com /doc/administrator/en/mysql-administrator-user-administration-user-accounts.html

1st if you are Windows User, you can use MySql Administrator. http://dev.mysql.com/doc/administrator/en/mysql-administrator-user-administration-user-accounts.html

第二,您可以使用来自Mysql Utilities的mysquserclone命令: http://wb.mysql. com/utilities/man/mysqluserclone.html

2nd you can use mysquserclone command from Mysql Utilities: http://wb.mysql.com/utilities/man/mysqluserclone.html

祝你好运.

这篇关于MySQL复制用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆