32 lines
563 B
Markdown
32 lines
563 B
Markdown
---
|
|
categories: databases
|
|
title: MySQL : Gestion des utilisateurs
|
|
format: markdown
|
|
...
|
|
|
|
|
|
## Obtenir la liste des utilisateurs
|
|
|
|
```bash
|
|
mysql> SELECT User, Host from mysql.user;
|
|
```
|
|
|
|
## Créer un nouvel utilisateur
|
|
|
|
```bash
|
|
mysql> CREATE USER `<user>`@`<host>` IDENTIFIED BY `<password>`;
|
|
```
|
|
|
|
## Affecter des droits à un utilisateur
|
|
|
|
```bash
|
|
mysql> GRANT ALL PRIVILEGES ON <database>.* TO `<user>`@`<host>` IDENTIFIED BY `<password>`;
|
|
mysql> FLUSH PRIVILEGES;
|
|
```
|
|
|
|
## Vérifier les droits d'un utilisateur
|
|
|
|
```bash
|
|
mysql> SHOW GRANTS FOR `<user>`@`<host>`;
|
|
```
|