MySQL 如何为所有远程用户要求 SSL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16120856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to require SSL for all remote users
提问by docwhat
Given a MySQL system with multiple remote users (users of the form 'joecool'@'192.168.1.2'); is there a SQL statement I can use to REQUIRE SSLfor all the remote users?
给定一个具有多个远程用户(表单用户'joecool'@'192.168.1.2')的 MySQL 系统;是否有我可以REQUIRE SSL用于所有远程用户的 SQL 语句?
The single user command is:
单用户命令是:
GRANT USAGE ON *.* TO 'joecool'@'192.168.1.2' REQUIRE SSL;
Having an "all user" version would be especially useful because phpMyAdmindoesn't support the REQUIRE SSL flag when creating or modifying users.
拥有“所有用户”版本将特别有用,因为phpMyAdmin在创建或修改用户时不支持 REQUIRE SSL 标志。
采纳答案by lmeurs
The (formerly) accepted answer by Honza seems incorrect, see its comments. It seems not possible to use a GRANTquery to alter multiple users at once since MySQL does not support wildcards for user names.
Honza(以前)接受的答案似乎不正确,请参阅其评论。GRANT由于MySQL 不支持用户名的通配符,因此似乎不可能使用查询同时更改多个用户。
As you suggested yourself you can alter records in the mysql.usertable directly using an UPDATEquery and as Marc Delisle suggested, afterwards flush priviliges with:
正如您自己建议的那样,您可以mysql.user使用UPDATE查询直接更改表中的记录,并且正如 Marc Delisle 建议的那样,然后使用以下方法刷新特权:
FLUSH PRIVILEGES;
Also see dba.stackexchange.com > How to grant multiple users privileges.
回答by Italo Borssatto
You can configure mysqldwith require_secure_transport.
您可以mysqld使用require_secure_transport进行配置。
[mysqld]
...
ssl-ca = ...
ssl-cert = ...
ssl-key = ...
...
require-secure-transport = ON
This capability supplements per-account SSL requirements, which take precedence. For example, if an account is defined with REQUIRE SSL, enabling require_secure_transport does not make it possible to use the account to connect using a Unix socket file.
此功能补充了优先的每个账户 SSL 要求。例如,如果使用 REQUIRE SSL 定义帐户,则启用 require_secure_transport 并不能使用该帐户使用 Unix 套接字文件进行连接。
回答by Marc Delisle
Yes, you can modify the mysql.user table directly (be careful). Then you just issue a FLUSH PRIVILEGES statement to apply the changes to the running server.
是的,你可以直接修改mysql.user表(小心)。然后您只需发出 FLUSH PRIVILEGES 语句将更改应用到正在运行的服务器。

