[DB]centos 7.0이상에서 mysql 8.0 yum(패키지) 설치

2022. 5. 31. 11:42DB



336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

https://www.mysql.com/products/community

# centos 7.0이상에서 mysql 8.0 yum(패키지) 설치

# 설치 할 URL 가져오기

> Download MySQL Community Edition 클릭
> MySQL Yum Repository 클릭
> 버전 선택 후 Download 클릭
> No thanks, just start my download. 에 우클릭 [ 링크 주소 복사 ]


repository 설치 완료 !

# repository 목록 확인
yum repolist enabled | grep "mysql.*"

# 설치 가능한 mysql 패키지 목록 확인
yum search mysql

# MYSQL 설치 진행
yum install -y mysql-server

# GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022"

> GPG (Gnu Privacy Guard) 에서 시스템 파일에 대한 사용자 엑세스 제한, 패키지 설치 제한이 설정 되어 있습니다.
따라서 이 제한을 없애주면 설치가 가능한데, 설치 가능한 방법만 찾아보자면
path : /etc/yum.repos.d/mysql-community.repo를 vim 으로 열고
gpgcheck=1을 모두 0으로 변경 하면 됩니다.

예 ) 아래와 같이 여러개가 있지만 모두 0으로 변경
[mysql-cluster-7.6-community]
name=MySQL Cluster 7.6 Community
enabled=0
gpgcheck=1 (<- 이 부분을 0으로 수정)
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# 다시 설치 진행
yum install -y mysql-server

설치 완료 : )

# 상태 확인
systemctl status mysqld
(설치 직후에는 꺼져 있음)

# 실행 및 서비스 등록
systemctl start mysqld
systemctl enable mysqld

# mysql 8.0 은 임시 비밀번호가 생성되며, 이 비밀번호로 접속이 가능합니다.
grep 'temporary password' /var/log/mysqld.log
> [MY-010454] [Server] A temporary password is generated for root@localhost: fmzXAHljQ9+2
와 같은 형식으로 패스워드가 보입니다.

# mysql 접속
mysql -u root -p
패스워드 입력

# ROOT 패스워드 변경
ALTER USER 'root'@'localhost' IDENTIFIED BY 'db)%#!';

# 오류 난다 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
니 패스워드 안전하지 않아, 정책 지켜 !

# 정책 확인
SHOW VARIABLES LIKE 'validate_password%';

# 또 오류난다 You must reset your password using ALTER USER statement before executing this statement
비밀번호 부터 바꾸란다.. 예라이

# 비밀번호 정책
8자 이상, 대소문자 최소 1회, 숫자 최소 1회, 특수문자 최소 1회 젠장

# ROOT 패스워드 정책대로 변경
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Db0531)%#!';

Query OK, 0 rows affected (0.01 sec 됬네)

# DB, User 생성 해보자
mysql> use mysql; (musql 스키마 사용)
mysql> create database 01db; (database 생성)
mysql> select host, user, plugin, authentication_string, password_last_changed from user;(user 테이블 확인한번)

mysql> CREATE USER '01User'@'%' IDENTIFIED BY 'Db0531)%#!'; (유져 생성, 패스워드 설정)
mysql> grant all privileges on fp.* to '01User'@'%'; (권한설정)
mysql> flush privileges; (반영)

# exit 로 나간 뒤 다시 접속 해보자
mysql -u 01User -p
Enter password : Db0531)%#!

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

잘 됩니당.

'DB' 카테고리의 다른 글

[DB] mac(m1) mysql 설치(homebrew)  (0) 2024.02.13
[MYSQL] timeout 설정  (0) 2021.02.01
[MYSQL] order by 조건  (0) 2018.07.19
[mysql] index / 인덱스  (0) 2017.01.03
[mongoDB] 외부 접속 설정 for centos  (0) 2015.08.27