gpt4 book ai didi

PHP - Azure mySQL 应用内随机更改端口

转载 作者:行者123 更新时间:2023-12-03 01:49:02 26 4
gpt4 key购买 nike

背景:我有一个在 Azure Web App 上运行的 PHP CMS,其中包含应用内的 MySQL。它已经运行良好几个月了,突然开始出现 SQL 错误“尝试以访问权限禁止的方式访问套接字”我挖掘了 CMS 并比较了 Azure 提供的连接字符串并发现 Azure 应用程序内 MySQL 的端口已更改为新端口,我不知道原因是什么。很快就更新了,现在可以使用了。但问题是,我必须从客户的提示中找出困难的方法。

问题:为什么端口发生变化以及是否会再次发生这种情况?我如何阻止它将来发生更改或明确指定我希望它今后使用哪个端口?

谢谢

最佳答案

这个问题已经由@Suwatch here回答了,其中表示:

A VM can host multiple WebApps; hence multiple in-app MySQL processes. When we start MySql process, we attempt to use the same port as before. However, it may be taken by other service or other in-app MySQL. As a result, the port may change. In addition, web app can be moved from one VM to another and the set of available ports will be different.

In order to write the stable client app, do make sure you read the connection info from env variable. See this for more details.

关于PHP - Azure mySQL 应用内随机更改端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41949852/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com