Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically Check MySQL's Option Values (key_buffer_size, innodb_buffer_pool_size, etc.)

Is it possible to programmatically (via. the SQL interface, a CLI tool, etc) check the values of options that are normally set in a MySQL server's my.cnf file?

I have a suspicion that the server I'm using is reading the incorrect configuration file, and I'd like to be able to check what the values are actually set to.

like image 906
Alan Storm Avatar asked Dec 10 '22 05:12

Alan Storm


1 Answers

You can access them via SELECT statements since they are exposed as global system variables.

SELECT @@key_buffer_size;
SELECT @@innodb_buffer_pool_size;

-- With a column alias you can use when fetching an associative array in PHP
mysql> SELECT @@key_buffer_size as keybufsize;
+------------+
| keybufsize |
+------------+
|    8388608 |
+------------+

You can, obviously, do this via PHP or the CLI, or whatever.

like image 63
Michael Berkowski Avatar answered Dec 11 '22 17:12

Michael Berkowski