본문 바로가기
⚙️백엔드/MySQL

MySQL - 계정 생성 / DB 생성 권한 부여

by Janger 2022. 9. 14.
728x90
반응형
계정 생성
create user '계정아이디'@localhost identified by '비밀번호'; <-내부에서만 접속

create user '계정아이디'@'%' identified by '비밀번호'; <- 외부에서도 접속

 

DB 생성 권한 부여
grant all privileges on *.* to '계정아이디'@localhost identified by '비밀번호';

 

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 에러가 발생한 경우

 

grant all privileges on *.* to '계정아이디'@localhost;

identified by 부분 지우고 다시 입력

 

 

 

계정 목록 확인
SELECT Host,User,plugin,authentication_string FROM mysql.user;

 

 

 

 

출처: 

https://k-channel.tistory.com/entry/PC%EC%97%90-mysql-%EC%84%A4%EC%B9%98%ED%95%98%EA%B3%A0-%EC%9C%A0%EC%A0%80user%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0

 

PC에 mysql 설치하고 유저(user)생성하기

mysql 유저생성하기 명령어 : create user 유저명@localhost identified by '비밀번호'; 위 명령어를 mysql을 활성화시킨후에 작성하면 된다. 유저명에는 원하는 유저명을 작성해주고 뒷부분에 '' 작은따옴표

k-channel.tistory.com

 

728x90
반응형