MySQL - How to get a list of Session Variables and their Values?

82
January 13, 2022, at 4:30 PM

Does anyone know if we can get a list of custom session variables for the current session in the latest version of MySQL?

For example, if I do this:

SET @var1 = JSON_OBJECT('test1','test2');
SET @var2 = 'Hello World!';

I'd like to get a list of these somehow, but SHOW SESSION VARIABLES does not show these custom values.

Any feedback would be appreciated. Thanks!

Answer 1

Thanks to @akina for pointing me in the right direction!

Here's how you get the list of all Custom Session Variables by each thread currently active on the server for a specific database:

SELECT * FROM performance_schema.user_variables_by_thread;
Rent Charter Buses Company
READ ALSO
How do I include other files in PHP?

How do I include other files in PHP?

I just started creating a website at my home

103
What causes CSS, HTML, javascript, or React to combine margins?

What causes CSS, HTML, javascript, or React to combine margins?

I have an element with a margin at the bottom of 10pxAnd immediately under this element, I place another element with margin at the top of 10px

90
Show .bmp file in ImageView Android 6

Show .bmp file in ImageView Android 6

My application receives ByteArray withbmp file in it from backend

83
utilize jQuery contextMenu with D3.js forced graph

utilize jQuery contextMenu with D3.js forced graph

I am trying to combine jQuery contextMenu (2x) with a simple D3

95