In the php background, we often do some mysql persistent queries. for example, if the execution time of an SQL statement is 60 seconds, can php disable mysql query if the execution time of msyql exceeds 30 seconds. in the php background, we often do some mysql persistent queries. if the execution time of an SQL statement is 60 seconds, can php set it?
If the execution time of msyql exceeds 30 seconds
To terminate the mysql query.
Reply content:
In the php background, we often do some mysql persistent queries. If the execution time of an SQL statement is 60 seconds, can php setIf the execution time of msyql exceeds 30 seconds
To terminate the mysql query.
Php. ini has a setting to set the mysql connection timeout in a request.
Php
Ini_set ('mysql. connect_timeout ', 30 );
However, this is the timeout time for all the mysql requests in your script. Your problem is that you want to set the timeout time for an SQL statement. This does not exist and does not seem to work.
UseMysqli
You can also set
$ Mysqli = mysqli_init ();
$ Mysqli-> options (MYSQL_OPT_READ_TIMEOUT, 30 );