본문 바로가기
개발

[mysql] mysql 사용하기

by m2162003 2020. 9. 22.

mysql 서버 접속

# mysql 서버 접속
mysql -uroot -p

 

특정 포트번호로 접속

mysql -u <username> -h <ip 주소> -p

비밀번호: user password

 

 

database 보기

mysql> show databases;

 

database 사용

mysql> use <db 이름>;

 

전체 유저 보기

mysql> select user, host from user;

 

유저 생성

mysql> create user '아이디'@'%' identified by '비밀번호';

 

권한 부여

1. 특정 db에 모든 권한(수정, 삭제 ..)  부여

mysql> grant all privileges on <DB이름>.* to '<username>'@'%';

 

2. 모든 db에 모든 권한 부여

mysql> grant all privileges on *.* to '<user name>'@'%';

'개발' 카테고리의 다른 글

[Docker] 도커 명령어 정리  (0) 2023.04.15
[Redis] Redis 서버 설치 및 명령어  (0) 2020.09.18

댓글