User accounts
The access control layer of MariaDB is based on accounts. An account is composed of a username and the name of the host from which the user connects. The account's syntax is shown as follows (the quotes are optional, if no special characters are used):
'username'@'hostname'
It is good practice to create new users with the CREATE USER
statement. Then, permissions can be assigned to the users with GRANT
. By default, MariaDB allows assigning permissions to accounts even if its user does not exist, in which case the server will automatically create it. Though, in this way, unwanted users could be created by mistyping the username in the GRANT
statement. The autocreation of users can be disabled by setting the NO_AUTO_CREATE_USER
flag in the SQL_MODE
system variable, shown as follows:
MariaDB [(none)]> SET @@global.sql_mode = CONCAT(@@global.sql_mode, ',NO_AUTO_CREATE_USER'); Query OK, 0 rows affected (0.07 sec)
In an account, both the username...