# System variables vs User-defined variables in MySQL?

MySQLMySQLi Database

## System Variables

The system variables are tightly typed variable. These are also known as global specific variable.

The system variable can be initialized somewhere in global and contains the value of system variables until the server restarts. This value will destroy whenever you restart the MySQL server. The predefined system variable is prefixed with symbol @@.

## User-defined Variable

The user defined variable is also known as session-specific variable. It is a type of loosely typed variable which can be initialized somewhere in session and contains the value of user defined variable until session ends. The user defined variable is prefixed with symbol @.

For Example:

@anyVariableName
Published on 25-Feb-2019 15:05:48