Error
Error Code:
1193
MySQL Error 1193: Unknown System Variable Reference
Description
This error occurs when MySQL encounters a reference to a system variable name that it does not recognize. This typically happens during server startup, when processing configuration files (like `my.cnf` or `my.ini`), or when a client tries to set or retrieve a non-existent variable using `SET` or `SELECT @@var_name`.
Error Message
Unknown system variable '%s'
Known Causes
3 known causesTypo or Misspelling
A simple spelling mistake or incorrect casing in the system variable name within a configuration file or SQL statement.
Version Incompatibility
The specified system variable does not exist in the installed MySQL server version, or it has been deprecated or renamed in your version.
Invalid Configuration Entry
An entry in the MySQL configuration file (`my.cnf` or `my.ini`) refers to a system variable that MySQL does not recognize.
Solutions
4 solutions available1. Correct Typo in System Variable Name easy
The most common cause is a simple spelling mistake in the system variable name.
1
Carefully review the SQL statement or configuration file where the system variable is referenced. Compare the name you've used with the correct syntax for MySQL system variables. System variable names are case-insensitive, but typos are common.
SET GLOBAL my_sql_variable = 'value'; -- Incorrect
SET GLOBAL mysql_variable = 'value'; -- Correct (example)
2
If you are unsure of the exact name, consult the MySQL documentation for your specific version to find the correct system variable name.
Refer to the official MySQL documentation for your version (e.g., https://dev.mysql.com/doc/refman/8.0/en/system-variables.html)
2. Verify System Variable Availability for Your MySQL Version medium
The system variable might not exist in your current MySQL version or edition.
1
Check the MySQL documentation for your specific version to confirm if the system variable you are trying to access actually exists. Some variables are introduced in later versions or are specific to certain editions (e.g., Enterprise Edition).
Example: If you are trying to set 'innodb_flush_log_at_trx_commit' on a very old MySQL version, it might not be available or have a different name.
2
If the variable is not available, you will need to find an alternative or upgrade your MySQL server if the functionality is critical.
No direct code fix, requires research or upgrade.
3. Check Scope of System Variable (GLOBAL vs. SESSION) easy
You might be trying to set a GLOBAL variable at the SESSION level or vice-versa.
1
System variables can be set at the GLOBAL level (affecting all connections) or SESSION level (affecting only the current connection). Ensure you are using the correct scope for the variable.
SET GLOBAL read_only = ON; -- Sets for all new connections
SET SESSION read_only = ON; -- Sets only for the current connection
2
Some variables are read-only or can only be changed at one scope. Check the documentation to understand the scope and mutability of the variable.
Refer to the MySQL documentation for the specific variable to understand its scope and whether it can be modified.
4. Investigate Configuration File Issues medium
Incorrectly formatted or placed variables in configuration files can lead to this error.
1
If the error occurs during MySQL startup or when applying configuration changes, examine your `my.cnf` or `my.ini` file. Ensure that system variables are correctly placed within the appropriate sections (e.g., `[mysqld]`).
[mysqld]
some_variable = value
other_variable = another_value
2
Verify the syntax for each variable. Incorrect spacing, missing equals signs, or invalid values can cause parsing errors. After making changes, restart the MySQL server for them to take effect.
Example of incorrect syntax:
some_variable : value
some_variable =value
Correct syntax:
some_variable = value
3
If you are using `SET GLOBAL` commands in scripts that are executed automatically, ensure these scripts are properly formatted and that the variables they reference are valid.
Example of a startup script that might cause issues:
SET GLOBAL unknown_var = 1;