데이터베이스 이야기/MySQL

[MySQL] 리눅스 CentOS7.x + mysql 5.7 이하버전 설치 후 계정 셋팅, 외부 접속 허용

한희성 2020. 9. 15. 22:07
반응형

[비밀번호 설정]

 

mysql -uroot

 

use mysql;

 

5.7 이하

update user set password=password('root1234') where user='root';

5.7 이후

update mysql.user set authentication_string = password('비밀번호')

where user='root'

 

flush privileges;

 

[외부 접근 허용]

 

grant all privileges on *.* to 'root'@'%' identified by 'root1234';

create user 'root'@'ip 또는 대역' identified by '비밀번호';

 

flush privileges;

반응형