CentOS 기준입니다.
7, 8 버전에 맞춰서 아래 파일을 다운로드 한다.
CentOS 7
# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
CentOS 8
# wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
다운로드 받은 rpm 설치
# rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
혹은
# rpm -Uvh mysql80-community-release-el8-1.noarch.rpm
/etc/yum.repos.d/mysql-community.repo 수정
[mysql80-community] 항목의 enabled=0 => 1로 변경
mysql rpm 설치
# yum install mysql mysql-server
mysql-server 데몬 실행
# systemctl start mysqld
초기 임시 패스워드 확인 (A temporary password 부분)
# cat /var/log/mysqld.log
----------
2021-02-08T07:31:22.142319Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.23) initializing of server in progress as process 19733
2021-02-08T07:31:22.206205Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-02-08T07:31:24.576335Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-02-08T07:31:26.250719Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: /49LtfcKqNOu
2021-02-08T07:31:29.735853Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 19795
2021-02-08T07:31:29.769227Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-02-08T07:31:30.379689Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-02-08T07:31:30.546393Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-02-08T07:31:30.828315Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-02-08T07:31:30.828558Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-02-08T07:31:30.860183Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
-------------
로컬에서 접속
# mysql -uroot -p [엔터]
Enter password: [위의 초기 패스워드 입력]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23
Copyright (c) 2000, 2021, 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>
패스워드 변경
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '변경할패스워드';
Query OK, 0 rows affected (0.07 sec)
[추가로 외부에서 접속 허용할 때]
mysql> use mysql;
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
변경된 권한 적용
mysql> flush privileges;
이제 변경된 패스워드로 로컬 혹은 외부에서도 접속할 수 있습니다.
'프로그래밍' 카테고리의 다른 글
nginx 배드 봇 차단(badbot block) 간단하게 설정하기 (0) | 2021.02.16 |
---|---|
클라우드 서버 사용시 인바운드 아웃바운드 트래픽 개념, 과금 기준 (0) | 2021.02.15 |
certbot letsencrypt 와일드카드 무료 인증서 발급하기 (0) | 2021.02.05 |
맥에서 파일 이동하기 붙여넣기(복사아님) (0) | 2021.01.20 |
카카오톡 프사 랭킹 사이트 내 프사 몇 점일까? (0) | 2021.01.08 |