생계/MySQL2017. 9. 8. 23:35

- 1. mysql client 접속 


mysql -u root -p

use mysql
select host, user, password from user;

 

 - 2.1 create user 구문으로 유저생성

 

create user 'test'@'%' identified by 'test';

CREATE USER 'test'@'10.10.10.10' IDENTIFIED WITH 'mysql_native_password' AS
  #authentication_string# REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
=> IP추가 시 비밀번호 직접 넣지 않고 동일하게 생성

 - 2.2 insert 구문으로 유저생성

 

insert into user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string)
values ('localhost','test', password('test'),'','','','');

 

insert into user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string)
values ('%','test', password('test'),'','','','');

 

flush privileges;     -- * insert 구문으로 유저생성시엔 반드시 flush 해줘야 적용됨.

 

 - 3. 권한 grant

 

grant all privileges on temp.* to test@'localhost';
grant all privileges on temp.* to test@'%';

grant all privileges on *.* to test@'%';

 

  - 4. 권한 확인

 

show grants for test@'%';

 

 

반응형
Posted by 돌고래트레이너