mysql - Why I could not alter the variable long_query_time variable at runtime -
I am using MySQL version 5.1.66. I noticed that the variable is dynamic, but when I tried
set global long_query_time = 1; After the above action, I tried again
mysql> Variables like show 'long_query_time'; + ----------------- + ----------- + | Variable_name | Price | + ----------------- + ----------- + | Long_query_time | 10.000000 | + ----------------- + ----------- + 1 line set (0.00 seconds) MySQL It is not being changed from the console, why?
You are setting the global system variable, but you have query for session variables for the current session For the global variable setting to be effective, you need to reconnect, or @@ sessions. Long_query_time variables must be set. (Note that the versions shown by default show the session variables.)
Here is an example:
mysql> Show versions like session "long_query_time"; + ----------------- + ----------- + | Variable_name | Price | + ----------------- + ----------- + | Long_query_time | 10.000000 | + ----------------- + ----------- + mysql & gt; SET @@ GLOBAL.long_query_time = 1; Mysql & gt; Show global versions like "long_query_time"; + ----------------- + ---------- + | Variable_name | Price | + ----------------- + ---------- + | Long_query_time | 1.000000 + ----------------- + ---------- + mysql & gt; Show variations like "Long_query_time"; + ----------------- + ----------- + | Variable_name | Price | + ----------------- + ----------- + | Long_query_time | 10.000000 | + ----------------- + ----------- +
Comments
Post a Comment