Friday, January 6, 2012

Mysql show variables command

Advertisements


show variables is a command to see the variables and their values. You can use this either with mysqladmin command or from the mysql prompt

With mysqladmin command :
root@cpaneltest [~]# mysqladmin variables | less
+-----------------------------------------+-----------------------------------------+
| Variable_name                           | Value                                   |
+-----------------------------------------+-----------------------------------------+
| auto_increment_increment                | 1                                       |
| auto_increment_offset                   | 1                                       |
| automatic_sp_privileges                 | ON                                      |
| back_log                                | 50                                      |
| basedir                                 | /                                       |
| binlog_cache_size                       | 32768                                   |
| bulk_insert_buffer_size                 | 8388608                                 |
| character_set_client                    | latin1                                  |
+-----------------------------------------+-----------------------------------------+

From mysql prompt :
mysql> show variables;
+-----------------------------------------+-----------------------------------------+
| Variable_name                           | Value                                   |
+-----------------------------------------+-----------------------------------------+
| auto_increment_increment                | 1                                       |
| auto_increment_offset                   | 1                                       |
| automatic_sp_privileges                 | ON                                      |
| back_log                                | 50                                      |
| basedir                                 | /                                       |
| binlog_cache_size                       | 32768                                   |
| bulk_insert_buffer_size                 | 8388608                                 |
| character_set_client                    | latin1                                  |
+-----------------------------------------+-----------------------------------------+

To see the variables starting with max :

mysql> show variables like 'max%';
+----------------------------+----------------------+
| Variable_name              | Value                |
+----------------------------+----------------------+
| max_allowed_packet         | 1048576              |
| max_binlog_cache_size      | 4294963200           |
| max_binlog_size            | 1073741824           |
| max_connect_errors         | 10                   |
| max_connections            | 500                  |
| max_delayed_threads        | 20                   |
| max_error_count            | 64                   |
| max_heap_table_size        | 16777216             |
| max_insert_delayed_threads | 20                   |
| max_join_size              | 18446744073709551615 |
| max_length_for_sort_data   | 1024                 |
| max_prepared_stmt_count    | 16382                |
| max_relay_log_size         | 0                    |
| max_seeks_for_key          | 4294967295           |
| max_sort_length            | 1024                 |
| max_sp_recursion_depth     | 0                    |
| max_tmp_tables             | 32                   |
| max_user_connections       | 35                   |
| max_write_lock_count       | 4294967295           |
+----------------------------+----------------------+
19 rows in set (0.00 sec)
mysql>

To set a variable a fixed value :
root@cpaneltest [~]# vi /etc/my.cnf
[mysqld]
max_allowed_packet=128M
save it
then restart mysql service. 



No comments:

Post a Comment

Be nice. That's all.