The MySQL system variables include global variables (globals) and session variables (sessions), the global variable takes effect for all session, and the session variable includes the global variable. MySQL tuning is bound to involve the adjustment of these system variables, so we first have to query the system variables.
1, query global variables: show global variables \g;
2. Query session variable: show session variables \g; or show variables;
As you can see, the variable table contains variable_name,value two fields, so you can filter the queries by these two fields.
3, query does not open the log configuration: show global variables where variable_name like '%log% ' and value= ' off ';
We can also query system variables using the Select field, with the following syntax
4, query Global log_bin variable: SELECT @ @global. log_bin;
5. Query Session variable: SELECT @ @session. [Field name]
6, the variable level is not clear, using the Select @@[field name query, the first query session variables, and then query global variables.
7. Query MySQL run statistics and status data: Show status. Similar to show variables, do not repeat.
MySQL system variable Query