컴퓨터 / Computer

MySQL/MariaDB DB 생성 및 사용자 아이디 생성

공유지기 0 220 07.17 11:42

0_fivEmSUN_cafc0046fceae53820e6e11ed19a3a0d3034ec3c.jpg 






1. update문을 이용하여 root 암호 설정


 $ mysql -u root mysql


 mysql> update user set password = password('new-password') where user = 'root';

 mysql> flush privileges;



2. set password를 이용하여 root 암호 설정


 mysql> set password for root = password('new-password');



3. 데이터베이스 보기


 myslq> show databases;


4. 데이터베이스 생성


 mysql> create database DB명;


5. 일반 사용자 추가

 mysql> grant all privileges on dbuser.* to dbuser@localhost identified by 'password' with grant option;


6. 특정 이름의 데이터베이스에 대한 모든 권한을 가지는 사용자 추가

 mysql> grant all privileges on `dbuser_%`.* to dbuser@localhost identified by 'password' with grant option;


7. 모든 권한을 준다면 아래와 같은 방법을 하는것이 더욱 편리힙니다.


 mysql> GRANT ALL on DB명.* TO id@'localhost'  ;

 mysql> GRANT ALL on DB명.* TO id;

 mysql> GRANT ALL on DB명.* TO id@'xxx.xxx.xxx.%';


8. 반영할때


 mysql> FLUSH PRIVILEGES;

Comments

벤츠 순정형 와이퍼 CLA클래스 C117 14-15년
칠성상회
우진 원비봉투 교육회비영수표 (A4) 52번 100매 / 100매/팩 / 143800
칠성상회
고급형 부직포 가로쇼핑백 가방 투톤블랙 소
칠성상회
컬러 사랑의 용돈 약봉투 소량 4type [시즌4 간식 남자친구 포장 감동시키기 이벤트]
칠성상회