728x90
컨테이너 접속
docker exec -i -t {컨테이너이름} bash
Mysql 루트 접속
bash-4.4# mysql -u root -p
데이터베이스 확인 후 생성
데이터 베이스 확인
show databases;
데이터베이스 생성
create database {database이름};
유저 생성
유저 확인
mysql> use mysql;
mysql> select host, user from user;
유저 생성
mysql> create user '{유저이름}'@'localhost' identified by '{유저패스워드}';
mysql> create user '{유저이름}'@'%' identified by '{유저패스워드}';
유저 권한 부여
권한 확인
mysql> show grants for {유저이름}@'localhost';
mysql> show grants for {유저이름}@'%';
권한 부여
mysql> grant all privileges on {DB이름}.* to '{유저이름}'@'localhost';
mysql> grant select, insert, update on {DB이름}.* to '{유저이름}'@'%';
728x90
'database' 카테고리의 다른 글
[DB] WHERE과 HAVING 차이 (0) | 2024.03.05 |
---|