Bug #114598 The `variables_info` table in MySQL for Windows shows incorrect results.
Description:
1. The variables_info table displays, for each system variable, the source from which it was most recently set and its range of values.
2. If I do not specify the --defaults-file option when starting mysqld, the parameters should follow a search path and load the my.ini/my.cnf file found along that path, reflecting in the variables_info table like this:
```sql
mysql> SELECT * FROM performance_schema.variables_info WHERE VARIABLE_NAME='report_host';
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
| report_host | GLOBAL | /etc/mysql/my.cnf | 0 | 0 | NULL | NULL | NULL |
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
1 row in set (0.00 sec)
```
However, in the Windows version of mysqld, even though it loads the my.ini from the search path, it still shows that it is reading from the built-in variable:
```sql
mysql> SELECT * FROM performance_schema.variables_info WHERE VARIABLE_NAME='report_host';
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
| report_host | COMPILED | | 0 | 0 | NULL | NULL | NULL |
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
1 row in set (0.00 sec)
```
This behavior differs from that on Linux versions, and I believe it to be a bug.
How to repeat:
I tested it using version 8.0.35.
**Linux:**
1.Modify the my.cnf file located in a search path.
```
vi /etc/mysql/my.cnf
[mysqld]
report_host='fander'
```
2.Do not specify the --defaults-file option when starting mysqld.
```
mysqld &
```
3. Login and select SQL
```
mysql
mysql> SELECT * from performance_schema.variables_info where VARIABLE_NAME='report_host';
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
| report_host | GLOBAL | /etc/mysql/my.cnf | 0 | 0 | NULL | NULL | NULL |
+---------------+-----------------+-------------------+-----------+-----------+----------+----------+----------+
1 row in set (0.01 sec)
mysql> show variables like 'report_host';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| report_host | fander |
+---------------+--------+
1 row in set (0.01 sec)
```
**WIN:**
1.Modify the my.cnf file located in a search path.
```
notepad C:\Users\cjc44\Downloads\mysql-8.0.35-winx64\mysql-8.0.35-winx64\my.ini
[mysqld]
report_host='fander'
```
2.Do not specify the --defaults-file option when starting mysqld.
```
mysqld &
```
3. Login and select SQL
```
mysql -uroot
mysql> SELECT * from performance_schema.variables_info where VARIABLE_NAME='report_host';
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
| VARIABLE_NAME | VARIABLE_SOURCE | VARIABLE_PATH | MIN_VALUE | MAX_VALUE | SET_TIME | SET_USER | SET_HOST |
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
| report_host | COMPILED | | 0 | 0 | NULL | NULL | NULL |
+---------------+-----------------+---------------+-----------+-----------+----------+----------+----------+
1 row in set (0.01 sec)
mysql> show variables like 'report_host';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| report_host | fander |
+---------------+--------+
1 row in set, 1 warning (0.00 sec)
```
Suggested fix:
Fix the behavior of the variables_info table in the Windows version of mysqld to match that of Linux.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.