REQUIRE

REQUIRE in SQL is a clause used in combination with the GRANT command to stipulate certain security necessities. It specifies that a particular SSL certificate must be presented by the client before the server allows a connection. There are various SSL requirements such as "NONE", "SSL", "X509", "CIPHER", "ISSUER", "SUBJECT" and so on, each serving different security functions.

Example

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'password';
ALTER USER 'user1'@'localhost' REQUIRE SSL;

Output

Query OK, 0 rows affected (0.04 sec)

Explanation

In the provided example, a new user ‘user1’ is created. Next, the REQUIRE SSL clause is used to ensure that the user can only connect to the MySQL server through an encrypted channel. The server returns Query OK indicating that the operations were successful.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.