use mysql;
select user, host from user;
mysql -u root -p mysql
# 사용자 생성
create user 'USER_ID'@'localhost' identified by 'USER_PASSWORD';
# 사용자 생성 예시
create user 'test'@'localhost' identified by 'test1234';
==================================================================
# 사용자 권한
grant all privileges on DATABASE_NAME.* to USER_ID@'localhost';
# 예시
grant all privileges on test_database.* to test@'localhost';
grant all privileges on DATABASE_NAME.* to USER_ID@'localhost' identified by 'USER_PASSWORD';
# 예시
grant all privileges on test_database.* to test_grant@'localhost' identified by 'test1234';
grant all privileges on DATABASE_NAME.* to USER_ID@'%' identified by 'USER_PASSWORD';
# 예시
grant all privileges on test_database.* to test_grant@'%' identified by 'test1234';
use mysql; Database changed mysql> update user set password=PASSWORD('변경할 비밀번호');
where user='사용자이름';
flush privileges;
delete from user where user='USER_ID';
flush privileges;
delete from user where user='test';
![[MySQL] 사용자 관리 명령어: 조회, 생성, 삭제, 권한 부여, 비밀번호 변경](/posts/mysql-user-commands-grant-password/images/image_1.jpg)