[FIXED] Cannot set a global variable on MySQL

Issue

I'm using MySQL in localhost (in ubuntu and also in windows). I want to set a global variable, and I have tried in all ways but even though I get an "ok" message from mysql, then when I do the "select @var" it allways says "NULL". I've tried:

set global var=17;
set @global.var=17;
set @@var=17;

Can anyone help me?

Thanks in advance.

ps: I have the SUPER privilege.


Solution

The variable name var does not reference a valid system variable. The GLOBAL and SESSION keywords in the SET statement are used for specifying the scope when setting MySQL system variables, not MySQL user variables.

Try for example:

SELECT @@global.net_read_timeout ;

SET GLOBAL net_read_timeout = 45 ;

SELECT @@global.net_read_timeout ;

http://dev.mysql.com/doc/refman/8.0/en/set-statement.html

http://dev.mysql.com/doc/refman/5.5/en/set-statement.html



Answered By - spencer7593
Answer Checked By - Marie Seifert (sql.easybugfix Admin)

Related Posts

Post a Comment