31 lines
570 B
Markdown
31 lines
570 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>`;
|
|
```
|