www.cyberciti.biz/faq/how-to-show-list-users-in-a-mysql-mariadb-database/

 

How to see/get a list of MySQL/MariaDB users accounts - nixCraft

I am using MariaDB mysql command. How do I see MySQL users in a MySQL/MariaDB database stored on my server?

www.cyberciti.biz

 

 

## User 생성
CREATE USER '[UserID]'@'[Host]' IDENTIFIED BY '[Password]';

ex )
CREATE USER 'kopo'@'%' IDENTIFIED BY 'kopo';   ## '%'는 모든 IP 허용
CREATE USER 'kopo2'@'localhost' IDENTIFIED BY '1234';

## 권한 부여
GRANT [type_of_permission] ON [database_name.table_name] TO '[username]'@'[host]';

ex )
GRANT all privileges on *.* TO 'kopo'@'%'; 

## 권한 뺐기
REVOKE [type_of_permission] ON [database_name.table_name] FROM '[username]'@'[host]';

## User 삭제
DROP USER '[username]'@'[localhost]';

## User 조회
SELECT USER FROM mysql.user;

## User, Host 조회
SELECT USER,HOST FROM mysql.user;

## 권한 설정 DB 서버 재시작 없이 적용 (우분투에서 source /etc/profile 하던 것과 같은거다)
FLUSH PRIVILEGES;

+ Recent posts