Bug #114598 The `variables_info` table in MySQL for Windows shows incorrect results.
Submitted: 9 Apr 15:19 Modified: 10 Apr 10:15
Reporter: fander chan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:8.0 OS:Windows
Assigned to: CPU Architecture:Any

[9 Apr 15:19] fander chan
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.
[10 Apr 10:15] MySQL Verification Team
Hi Mr. chan,

Thank you for your bug report.

This is truly a Windows specific bug in our Performance Schema.

It is a rather low priority bug, but still a bug.

Verified as reported.