Skip to content

GLOBAL

CREATE DATABASE testDB;
USE testDB;
CREATE TABLE Employees (
Id INT,
Name VARCHAR(50),
Salary DECIMAL(8, 2)
);
INSERT INTO Employees (Id, Name, Salary) Values (1, 'John Doe', 75000.00);
SET GLOBAL max_connections = 200;
SHOW GLOBAL VARIABLES LIKE 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 200 |
+-----------------+-------+

In the example code, a database called testDB is created and used. A table Employees is then created in testDB, followed by an insertion of a record into it.

Then the session variable max_connections is set to 200 at a global level with SET GLOBAL max_connections = 200;.

The SHOW GLOBAL VARIABLES LIKE 'max_connections'; command is used to display the globally set variable for ‘max_connections’, which displays the max_connections value as 200 in the output as proof of the successful execution.