ssouf

mysql 데이터베이스 및 계정생성 본문

SQL/MY-SQL

mysql 데이터베이스 및 계정생성

황금니 2020. 6. 28. 23:04

1.데이터베이스 생성

mysql> create database 데이터베이스명;

 

2. 계정생성 및 권한주기

mysql> grant all privileges on 데이터베이스명.* to '계정명'@'IP주소' identified by '비밀번호'; 

 

- 특정 IP 주소허용

mysql> grant all privileges on 데이터베이스명.* to '계정명'@'192.168.0.0' identified by '비밀번호'; 

- localhost 허용

mysql> grant all privileges on 데이터베이스명.* to '계정명'@'localhost' identified by '비밀번호'; 

- 모든 IP 허용

mysql> grant all privileges on 데이터베이스명.* to '계정명'@'%' identified by '비밀번호'; 

 

- 패스워드는 변경없이 권한만 부여하는 경우

mysql> grant select, insert, update on test.* to user@localhost; 


 

3. 메모리에 적용

mysql> flush privileges;