Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to change wait_timeout and max_allowed_packet through PHP? [duplicate]

Tags:

php

mysql

Possible Duplicate:
how to check and set max_allowed_packet mysql variable

I am having some database issues and I want to increase my max_allowed_packet timer and decrease wait_timeout. Is there a way to set it through PHP like ini_set ( 'memory_limit', '32M' ); or something similar ?

like image 338
Neta Meta Avatar asked Dec 16 '22 15:12

Neta Meta


1 Answers

Yes, you can issue the SQL

SET GLOBAL max_allowed_packet=...

to change the value of max_allowed_packet, but as it is a global variable be aware that you have to reconnect for the change to become effective because changing global system variables does not affect currently open connections.

wait_timeout is a normal session variable that you can easily change for the current connection using

SET SESSION wait_timeout=...
like image 77
AndreKR Avatar answered Feb 25 '23 07:02

AndreKR