MySQL8 yum Install

by 민갤

Server /

환경: CentOS7.5

MySQL 최신 설치 URL 구하기

https://dev.mysql.com/downloads/repo/yum/ 

저장소 설치

# yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
(... skip ...)
Running transaction
  Installing : mysql80-community-release-el7-1.noarch	1/1
  Verifying : mysql80-community-release-el7-1.noarch	1/1

Installed:
  mysql80-community-release.noarch 0:el7-1

Complete!

패키지 설치

# yum -y install mysql-community-server
(... skip ...)
Replaced:
  mariadb-libs.x86_64 1:5.5.56-2.el7

Complete!

서비스 시작 및 확인

# systemctl start mysqld
# systemctl status mysqld

- 정상 실행 시 Artive: active (running) 표시

부팅시 자동 실행

# systemctl enable mysqld

접속

# mysql

초기 접속 시 에러

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

1. root 임시비밀번호 확인

# cat /var/log/mysqld.log 
(... skip ...)
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ?:.l!hoi/6kB
(... skip ...)

2. 임시 비밀번호로 로그인

# mysql -u root -p 
Enter password: ?:.l!hoi/6kB
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.13

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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

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

mysql>

3. 임시 비밀번호로 재설정

비밀번호 변경은 비밀번호 정책 때문에 임시 비밀번호로 재설정한 후에 할 수 있다.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '?:.l!hoi/6kB';
Query OK, 0 rows affected (0.26 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.04 sec)

재설정하지 않을 경우

ERROR 1820 (HY000) : You must reset your password using ALTER USER statement before executing this statement.

4. 비밀번호 정책 비활성화

정책 확인

mysql> SHOW VARIABLES LIKE 'validate_password%'

비활성화 후 flush

mysql> SET GLOBAL validate_password.policy=LOW;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)

- validate_password.policy 이름이 살짝 다를 수 있다.

활성화 되어 있을 때 비밀번호를 변경하려 할 경우

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

5. 비밀번호 변경

mysql> SET PASSWORD FOR 'root'@'localhost'='[8자 이상]';
Query OK, 0 rows affected (0.06 sec)

6. 인코딩 확인

mysql> status
Server	characterset:	utf8mb4
Db	characterset:	utf8mb4
Client	characterset:	utf8mb4
conn.	characterset:	utf8mb4

변경할 경우 /etc/my.cnf 편집

종료

mysql> quit
Bye

Author

민갤

민갤

Back-End Developer

꾸잉꾸잉하고 웁니다.

이전글 Apache yum Install

로그인

디코에 오신 것을 환영해요!
전문가들의 수많은 아티클 창고 🤓