6

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 ?

Community
  • 1
  • 1
Neta Meta
  • 4,001
  • 9
  • 42
  • 67
  • Those are Mysql settings that can be set with a Mysql query either per connection (called *Session*) or for the server (called *Global*). You do know about the `SET` statement in Mysql? - http://dev.mysql.com/doc/refman/5.5/en/set-statement.html - Whether or not you can change them depends on your database configuration and the access-level the user you connect to the database with has. It can not be generally answered if it is possible for you personally. Generally, there is a way to configure that per connection. – hakre Jan 03 '13 at 19:57
  • http://stackoverflow.com/questions/5688403/how-to-check-and-set-max-allowed-packet-mysql-variable – Hanky Panky Jan 03 '13 at 19:57
  • THanks hakre i will check the link you supplied – Neta Meta Jan 03 '13 at 20:00

1 Answers1

14

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=...
AndreKR
  • 32,613
  • 18
  • 106
  • 168