Permanently setting auto_increment_offset in MySQL

后端 未结 2 1584
Happy的楠姐
Happy的楠姐 2021-01-28 17:37

I ran the command as root:

set @@auto_increment_offset = 2;

But the effect cannot be seen from other connections. Why not? It is global.

2条回答
  •  不要未来只要你来
    2021-01-28 18:11

    To set it globally you should add prefix 'GLOBAL' or '@@global.'. For example -

    SET @@GLOBAL.auto_increment_offset = 2;
    

    The '@@' is the same as 'SESSION' or '@@session.', it sets session variable.

    Using System Variables.

提交回复
热议问题