大网数据广告活动
服务器运维问答

What are the benefits of connecting to MySQL using PHP-PDO's SSL attribute?

· 52CE 我爱测

I primarily develop PHP applications using MySQL as my database. Generally, the server running the application is on the same box as the MySQL server, though not always. I was reading in the PHP docs about SSL support http://php.…

问题原文

原帖链接 · thebarless · CC BY-SA 3.0

I primarily develop PHP applications using MySQL as my database. Generally, the server running the application is on the same box as the MySQL server, though not always.

I was reading in the PHP docs about SSL support http://php.net/manual/en/ref.pdo-mysql.php and I'm left with these questions:

  1. With the application and database server being in the same (localhost) environment, is it necessary to connect to MySQL using SSL?
  2. Is the benefit of this for when you're accessing information between two servers (application server & a database server)?
  3. What are "best-practices" for using a PDO-SSL connection?
  4. Is it safe to assume that using an SSL certificate for the client/server connection has nothing to do with PDO's SSL connection?

已采纳解答

原帖链接 · TheFiddlerWins · CC BY-SA 3.0

1) Not in most circumstances - you can(should) configure MySQL to be local only so unless someone has admin access to the box or is able to run as the MySQL user the SSL won't make a difference.

2) Absolutely, it prevents man in the middle (someone spoofing your webserver so they can query the database for instance) and sniffing data.

3)Same as with most SSL - use strong encryption (no SHA1), guard your keys, change them regularly etc.

4) Sort of, they don't need to be the same keys or anything but if your organization has a CA then you can simplify things but getting them to approve ("sign") your certificates which could make things simpler from a management point of view.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。