MySQL复制用户
我想在我的 MySQL 测试数据库上创建两个用户,一个对与生成报告等相关的表具有只读访问权限,另一个对相同的表具有读写访问权限。这是为了测试通常与只读用户连接但切换到读写用户以执行某些任务的子系统。我已经创建了具有正确权限的读写用户,现在我需要同一用户的只读版本。
我不想从头开始创建只读版本,因为我必须设置很多权限,这相当费力。有没有办法可以基于现有用户创建新用户,然后从新用户中删除 INSERT/UPDATE/DELETE 权限?类似 CREATE USER 'user2' LIKE 'user1'
或类似内容?如果可以的话,我在 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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
插入另一个表并更新列怎么样?像这样的东西:
How about inserting into another table, update columns? Something like:
我找到了两个选择。
第一,如果您是Windows用户,您可以使用MySql管理员。 http://dev.mysql.com /doc/administrator/en/mysql-administrator-user-administration-user-accounts.html
第二个你可以使用 Mysql 实用程序中的 mysquserclone 命令:http://wb.mysql.com/utilities/man/mysqluserclone.html
祝你好运。
I found two options.
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
2nd you can use mysquserclone command from Mysql Utilities: http://wb.mysql.com/utilities/man/mysqluserclone.html
Good luck.