wasup

MySQL) 유저목록 확인하기 - SELECT user, HOST FROM user; 본문

DataBase/MySQL

MySQL) 유저목록 확인하기 - SELECT user, HOST FROM user;

wasupup 2021. 5. 22. 14:12
반응형

컨테이너 접근

docker exec -it mysql1 bash

 

C:\Users\W>docker exec -it mysql1 bash
root@a8526aa51bb7:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.7.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

SHOW DATABASES; #DB보기

USE mysql #DB선택

 

SELECT user, HOST FROM user; #유저목록확인

SHOW GRANTS FOR user1; #권한확인

 

SHOW DATABASES;
USE mysql;
SELECT user, HOST FROM user;

 

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| studydb            |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> 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
mysql> select user, host from user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| root          | %         |
| user1         | %         |
| user2         | %         |
| user3         | %         |
| user4         | %         |
| mysql.session | localhost |
| mysql.sys     | localhost |
| root          | localhost |
+---------------+-----------+
8 rows in set (0.00 sec)

mysql> show grants for user1;
+--------------------------------------------+
| Grants for user1@%                         |
+--------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%' |
+--------------------------------------------+
1 row in set (0.00 sec)

 

반응형
Comments