====== Gestion des utilisateurs mariaDB ======
===== Création d'un user =====
MariaDB [(none)]> CREATE USER foo@'10.%' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0,003 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select Host, User, Password from user;
+-----------+-------------+-------------------------------------------+
| Host | User | Password |
+-----------+-------------+-------------------------------------------+
| localhost | mariadb.sys | |
| localhost | root | invalid |
| localhost | mysql | invalid |
| 10.% | foo | *2470C0C02FEE4B9D15ADC618B6DD1900A2EC9E19 |
+-----------+-------------+-------------------------------------------+
4 rows in set (0,002 sec)
===== Connexion d'un user =====
==== 127.0.0.1 ====
root:~# mariadb -u foo -ppassword
ERROR 1045 (28000): Access denied for user 'foo'@'localhost' (using password: YES)
==== 10.1.40.1 ====
root:~# mariadb -u foo -ppassword -h 10.1.40.1
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1350
Server version: 10.11.3-MariaDB-1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
===== Suppression d'un user =====
MariaDB [(none)]> DROP USER foo@'10.%';
Query OK, 0 rows affected (0,002 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select Host, User, Password from user;
+-----------+-------------+----------+
| Host | User | Password |
+-----------+-------------+----------+
| localhost | mariadb.sys | |
| localhost | root | invalid |
| localhost | mysql | invalid |
+-----------+-------------+----------+
3 rows in set (0,002 sec)
===== Configuration =====
En parallèle, il faut que le serveur accepte les connections venant du réseau local.
[mysqld]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 10.1.40.1
===== Sources =====
*[[https://mariadb.com/kb/en/create-user/|create user / Site mariaDB]]
*[[https://mariadb.com/kb/en/drop-user/|drop user / Site mariaDB]]
===== Sujets connexes =====
* [[mariadb|Installation de mariaDB]]
* [[mariadb_grant|Gestion des autorisations]]