VMware에 웹서버 구축하기(DB설치하기_MYSQL)
INTRO
테스트용 웹서버 구축하기 마지막!!
DB설치하기 입니다. DB는 MYSQL로 설치하도록 하겠습니다.
CONTENTS
cd /usr/local/src (위치를 src로 이동)
RPM 설치
rpm -Uvh mysql-community-libs-5.7.20-1.el7.x86_64.rpm --force –nodeps
rpm -Uvh mysql-community-common-5.7.20-1.el7.x86_64.rpm
rpm -Uvh mysql-community-client-5.7.20-1.el7.x86_64.rpm
rpm -Uvh mysql-community-server-5.7.20-1.el7.x86_64.rpm
mysqld --version (Mysql 버전 확인)
Mysql 실행 및 상태확인
systemctl start mysqld (Mysql 실행)
systemctl status mysqld (Mysql 상태확인)
Mysql 비밀번호 설정
1)임시비밀번호 가져오기
grep 'temporary password' /var/log/mysqld.log
위 붉은 박스 문자열이 Mysql 설치 시 생성된 임시 비밀번호 값.
2)사용할 비밀번호 설정
/usr/bin/mysql_secure_installation
Enter password for user root : (임시 비밀번호 값 입력 후 엔터)
※주의 : 비밀번호 정책 숫자+특수문자+대문자를 포함한 8자이상.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
All done!
Mysql 접속
mysql -u root –p
Enter password : (새로 설정한 비밀번호 입력 후 엔터)
접속된 화면
WEB 서비스에 필요한 DB환경 명령어 정리
create database DBNAME default character set euckr;
create user 'ums'@'%'identified by '(정책에 맞춰 사용할 비밀번호 값)';
grant all privileges on *.* to 'ums'@'%';
FLUSH PRIVILEGES;
exit; (접속 종료)
Import DB Data
sql 파일이 있는 위치에서 명령어 실행
mysql -u root -p DBNAME < (파일이름).sql
Enter password : (root 계정 비밀번호 입력 후 엔터)
Export DB Data
mysqldump -u root -p --default-character-set=euckr DBNAME> (파일이름).sql
Enter password : (root 계정 비밀번호 입력 후 엔터)
● 버전에 따른 웹 기능 호환성 처리
vi /etc/my.cnf
맨 밑줄에 아래 문장 추가 후 저장
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
systemctl restart mysqld (Mysql 재시작)
OUTRO
DB설치를 끝으로 VMware에 웹서버 구축하기 포스팅을 마치도록 하겠습니다.
'Linux' 카테고리의 다른 글
VMware에 웹서버 구축하기(Apache & Tomcat 연동) (0) | 2022.09.05 |
---|---|
VMware에 웹서버 구축하기(Tomcat설치) (0) | 2022.09.05 |
VMware에 웹서버 구축하기(JDK 설치) (0) | 2022.09.05 |
VMware에 웹서버 구축하기(Apache 설치) (0) | 2022.09.05 |
VMware에 웹서버 구축하기(OpenSSL설치) (0) | 2022.09.05 |