U kunt de INFORMATION_SCHEMA GLOBAL_VARIABLES
. gebruiken en SESSION_VARIABLES
tabellen
zoals dit:
SELECT *
FROM information_schema.global_variables
WHERE variable_name LIKE '%version%';
Voorbeelduitvoer:
| VARIABLE_NAME | VARIABLE_VALUE | |-------------------------|--------------------------------------| | INNODB_VERSION | 5.5.32 | | PROTOCOL_VERSION | 10 | | VERSION_COMMENT | MySQL Community Server (GPL) by Remi | | VERSION | 5.5.32 | | VERSION_COMPILE_MACHINE | x86_64 | | VERSION_COMPILE_OS | Linux | | SLAVE_TYPE_CONVERSIONS | |
Hier is SQL Fiddle demo.
UPDATE (gebaseerd op uw opmerkingen)
U kunt alle variabelenamen specificeren die u nodig heeft met IN
clausule
SELECT *
FROM information_schema.global_variables
WHERE variable_name IN ('version', 'hostname', 'port');
Voorbeelduitvoer:
| VARIABLE_NAME | VARIABLE_VALUE | |---------------|----------------| | VERSION | 5.5.32 | | HOSTNAME | db2 | | PORT | 3306 |
Hier is SQL Fiddle demo.