28 lines
533 B
Markdown
28 lines
533 B
Markdown
categories: mysql
|
|
title: Gestion des utilisateurs
|
|
|
|
#### 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>`;
|
|
```
|