[SQL] DB관리 / User 관리

김보림·2024년 6월 4일
0

SQL 기초

목록 보기
2/17

DATABASE 관리


  • 데이터베이스 목록확인

 Show DATABASES;
  • 데이터베이스 이름지정해여 생성

CREATE DATABASES testdb;
  • 해당 DB 사용(이동)

USE testdb;
  • 해당 DB 삭제

 DROP DATABASE testdb;

USER 관리


사용자정보는 mysql에서 관리하므로 먼저 mysql로 이동
  • Mysql로 이동

USE mysql;
  • 유저 조회

SELECT host ,user FROM user;
  • 유저 생성 ( 2가지 )

CREATE user 'username'@'localhost' identified by 'passward';

or

CREATE user 'username'@'%' identified by 'passward';
Host 정보가 다르면 유저 아이디가 같아도 OK
  • 유저 삭제

DROP user 'username'@'loacalhost';

or

DROP user 'username'@'%';
profile
볼로그

0개의 댓글