HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

set global variable parameter?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
parameterglobalvariableset

Problem

My prod_server version is 5.1.47 and want to set the slow query log dynamically for certain period of time.
I refered one site(http://toastergremlin.com/?p=276) there is mentioned below 5.1.6 we need to set the variables into the my.cnf, but my prod_server is critical can't take my server restart is there any way we set variables dynamically for certain period of time?

Thank u in advance please help.

Solution

You can set any global variables to any value on the fly using below statement in MySQL prompt:

set global  = ;


In your case use the following to turn on slow query log:

set global slow_query_log=1;


By default the "slow wait time" is set to 10 sec, but you can change it as well.

Hope it helps.

Code Snippets

set global <variable> = <value>;
set global slow_query_log=1;

Context

StackExchange Database Administrators Q#94338, answer score: 2

Revisions (0)

No revisions yet.