mysql grant public,如何在MySQL中将SELECT ON表名授予PUBLIC

I am new to MySQL. I am trying to figure out how to make a table publicly readable to all authenticated users. In Oracle I would say grant select on tablename to public. This syntax does not work with MySQL and I cannot figure out the equivalent syntax.

解决方案MySQL does not support wildcards in user names. To refer to an

anonymous user, specify an account with an empty user name with the

GRANT statement:

GRANT ALL ON test.* TO ''@'localhost'

In this case, any user who connects from the local host with the

correct password for the anonymous user will be permitted access, with

the privileges associated with the anonymous-user account.

So you can grant select to anyone from localhost like

grant select on tablename to ''@'localhost'

(OR)

You can grant all users from a specific domain. Excerpt from MySQL doc

You can specify wildcards in the host name. For example,

user_name@'%.example.com' applies to user_name for any host in the

example.com domain, and user_name@'192.168.1.%' applies to user_name

for any host in the 192.168.1 class C subnet.

The simple form user_name is a synonym for user_name@'%'.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值