May I ask which configuration file the command "set global sql_mode = '';" is stored in?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 请问set global sql_mode = ‘’;是存储在哪个配置文件里了?

| username: Hacker_7b2KWuuo

I executed the command set global sql_mode = '';, can you tell me which configuration file it is stored in? Because I found that even if I restart the TiDB cluster, this parameter persists.

| username: Soysauce520 | Original post link

Check if there is a table named mysql.global_variables.

| username: 有猫万事足 | Original post link

TiDB supports modifying the sql_mode system variable at the session or global scope.

  • Modifications to global scope variables will take effect on other servers in the cluster after being set, and the changes will remain effective after a restart. Therefore, you do not need to change the sql_mode value on each TiDB server.
  • Modifications to session scope variables will only affect the current session after being set, and the changes will disappear after a restart.

If you want to check the current sql_mode, simply use

SHOW GLOBAL VARIABLES LIKE ‘sql_mode’;

| username: zhaokede | Original post link

Got it, I haven’t really paid attention to where it’s stored usually.

| username: wangkk2024 | Original post link

Learned.

| username: YuchongXU | Original post link

Configuration file, huh?

| username: jiayou64 | Original post link

Got it, I couldn’t find it either.

| username: DBAER | Original post link

In mysql.GLOBAL_VARIABLES

| username: 小龙虾爱大龙虾 | Original post link

The official documentation describes that “some variables with the GLOBAL scope will be persisted to the TiDB cluster,” which means they will be stored in TiKV. 系统变量 | PingCAP 文档中心

| username: 友利奈绪 | Original post link

It really is mysql.GLOBAL_VARIABLES.

| username: Kamner | Original post link

System parameters are stored in TiKV. If you only want the session to take effect, you can execute:

set session sql_mode = '';
| username: 小于同学 | Original post link

Check if there is a table named mysql.global_variables.

| username: TiDBer_QYr0vohO | Original post link

It should be stored in TiKV.

| username: TiDBer_ivan0927 | Original post link

Write to TiKV

| username: dba远航 | Original post link

TIDB is stored in TIKV.

| username: TiDBer_RjzUpGDL | Original post link

mysql.global_variables

| username: terry0219 | Original post link

Write to TiKV, specifically in the mysql.global_variables table.

| username: zhanggame1 | Original post link

TiKV has been persisted.

| username: stephanie | Original post link

This parameter has been persisted to TiKV.

| username: zhang_2023 | Original post link

I was wondering why I couldn’t find it…