一台服务器php连接数据库,数据库地址却用了对外的ip,造成偶尔获取数据库连接句柄需要2s
php mysql 连接句柄 外网ip php 2s 连接句柄 mysql
如题:服务器上php连接服务器上的mysql数据库,数据库地址却用了对外的ip,造成偶尔获取mysql数据库连接句柄需要2s,
就是说连接mysql的数据库地址用了外网的ip(如 22.34.1.12),
改成127.0.0.1就不会出新,获取连接句柄需要2s的情况,
这个2s是偶尔出现,想知道原因,具体点,谢谢
回复讨论(解决方案)
通过外网使用任何数据库都不是符合典范的做法,通常没有这样的server架构。
通过外网使用任何数据库都不是符合典范的做法,通常没有这样的server架构。
问题如我的题目,我用了这台服务器对外的ip地址,偶尔出现2s的原因是什么?
直销转传销,人家赚你2s的利润,不算狠了
通过外网使用任何数据库都不是符合典范的做法,通常没有这样的server架构。
问题如我的题目,我用了这台服务器对外的ip地址,偶尔出现2s的原因是什么?
不出事故只有一种情况,出事故的情况有无数。
这个和网络有关不。。。。
直销转传销,人家赚你2s的利润,不算狠了
牛哥,能具体点解释一下,在同一台服务器连接mysql数据库,用外网ip地址时,经过了哪些步骤.
如果只有一个ip,则直接访问
如果存在2个及以上ip,则需要路由
server->防火墙->isp->防火墙->mysql,然后再来一个反向,isp这段绕了多少圈就难说了
2s真的是在可接受范围之内,MYSQL有个设置不解析域名的参数 将这个启用看看.
2s真的是在可接受范围之内,MYSQL有个设置不解析域名的参数 将这个启用看看.
mysql的用户其实是由主机名和用户名两部分组成,所以mysql的登陆过程时确定客户端的主机名,
这个过程需要mysql服务器对客户端的IP进行 反向域名解析,确定客户端的主机名。
可以修改 skip-name-resolve 参数进行设置

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...
