[리눅스] MySQL 5.7 보안설정

간단한 명령어 하나로 보안 설정 및 MySQL root 암호를 변경하는 것을 진행하겠습니다.

MySQL 5.7 버전의 경우 /var/log/mysqld.log 파일 내에 임시 비밀번호가 저장됩니다.

다음의 명령어로 간단하게 찾으실 수 있습니다.

cat /var/log/mysqld.log | grep "temporary password"
[root@dothome-world ~]# cat /var/log/mysqld.log | grep "temporary password" 019-07-05T08:40:24.840936Z 1 [Note] A temporary password is generated for root@localhost: pyeF6fK7Du!/

위에서 나온 비밀번호(pyeF6fK7Du!/)를 복사하시거나 메모하신 후 다음 명령어로 보안 설정을 진행하겠습니다.

다음의 주석들을 확인해 보시면서 진행하시면 됩니다.

mysql_secure_installation
[root@dothome-world ~]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: # 임시 비밀번호 입력(pyeF6fK7Du!/) The existing password for the user account root has expired. Please set a new password. New password: # 사용 원하시는 MySQL root 암호 입력 Re-enter new password: # 재 입력 The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : No # 이미 변경해서 스킵 ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y # anonymous 계정 삭제 Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y # MySQL 원격 접속 비허용 Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y # TEST DB 삭제 - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y # grant 권한 재설정 Success. All done!
0
0
이 글을 페이스북으로 퍼가기 이 글을 트위터로 퍼가기 이 글을 카카오스토리로 퍼가기 이 글을 밴드로 퍼가기
captcha
자동등록방지 숫자입력

웹개발

번호 제목 글쓴이 날짜 조회수
122 [Dart] Dart 문법 정리 최고관리자 09-09 1,664
121 [Flutter] absorbpointer-and-ignorepointer 최고관리자 09-08 1,019
120 [PHP] 타입선언 최고관리자 08-22 884
119 [PHP] error_level 셋팅과 실제 출력 최고관리자 08-21 965
118 [MySql] 타입지정시 괄호안의 숫자 최고관리자 08-18 1,021
117 [MySql] MySQL 최적의 데이터 타입 선택 방법 최고관리자 08-18 697
116 [MySql] 인덱스 조회시 주의 사항 최고관리자 08-18 737
115 [MySql] NOT NULL과 DEFAULT 를 동시에 쓸 필요가 있는가? 최고관리자 08-18 768
114 [Flutter] Row and Column 최고관리자 08-16 678
113 [Flutter] Linting 설정으로, 흔하게 실수할 수 있는 것을 build 전 방지하기. 최고관리자 08-16 762
112 [PHP] PHP 7.x PHP 8.x에서의 조건문 최고관리자 07-26 712
111 [JS] Webpack을 쓰는 이유 최고관리자 07-24 837
110 [Vue] Vue Router 최고관리자 07-22 720
109 [Vue] Vue.js 기본 원리 최고관리자 07-22 1,232
108 [MySql] 쿼리 결과를 합치는 union vs union all의 차이 최고관리자 07-10 746
107 [Vue] 일반적인 프로젝트의 구조에 대해 알아보자. 최고관리자 06-18 825
106 [JSP] vue등의 스크립트 분석을 위해 %태그 정도는 알자. 최고관리자 06-18 942
105 [MySql] 페이징(paging) 쿼리시 전체개수를 한번에 처리하는 방법 최고관리자 06-14 1,532
104 [MySql] Join vs Sub Query 비교 최고관리자 06-05 954
103 [SQL] SQL Join에 대한 이해 최고관리자 06-05 838