사용 Software
제품명 |
버전 |
아키텍쳐 |
Oracle VirtualBox |
5.2.22 |
X86_64bit |
서버 정보
OS |
DB |
MEMORY |
Oracle Linux 7.5 |
MySQL 8.0.19 |
2048MB |
Binary설치의 경우 수동설치라고도 불리며 디렉토리를 비롯하며 사용자임의대로 DB를 구축할 수 있는 설치방법입니다.
설치파일 사이트
https://dev.mysql.com/downloads/mysql/
에서 OS에 맞는 OS 버전 선택 후 Tar 다운로드 클릭하여 다운받습니다.
1.SELINUX 끄기
아래 내용을 추가해서 SELINUX의 사용을 멈춥니다.
# vi /etc/selinux/config
SELINUX=disabled
MYSQL 설치
2.압축파일 풀기
#tar xvf mysql-8.0.19-el7-x86_64.tar.gz
mysql-8.0.19-el7-x86_64/bin/
mysql-8.0.19-el7-x86_64/bin/myisam_ftdump
mysql-8.0.19-el7-x86_64/bin/myisamchk
mysql-8.0.19-el7-x86_64/bin/myisamlog
mysql-8.0.19-el7-x86_64/bin/myisampack
mysql-8.0.19-el7-x86_64/bin/mysql
mysql-8.0.19-el7-x86_64/bin/mysql_config_editor
mysql-8.0.19-el7-x86_64/bin/mysql_secure_installation
mysql-8.0.19-el7-x86_64/bin/mysql_ssl_rsa_setup
mysql-8.0.19-el7-x86_64/bin/mysql_tzinfo_to_sql
mysql-8.0.19-el7-x86_64/bin/mysql_upgrade
mysql-8.0.19-el7-x86_64/bin/mysqladmin
3.유저 생성
# groupadd mysql
# useradd -r -g mysql -s /bin/false mysql
# id mysql
uid=988(mysql) gid=1001(mysql) groups=1001(mysql)
4.압축파일은 엔진디렉토리이며 원하는 디렉토리로 이동합니다.(매뉴얼에서는 /usr/local 아래에서 설치를 진행하였습니다.)
# mv mysql-8.0.19-el7-x86_64 /usr/local/
# mv mysql-8.0.19-el7-x86_64 mysql
5.Bash_profile에 mysql PATH 변수 추가
# vi .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
export PATH
6.데이터디렉토리를 생성해줍니다.(매뉴얼에서는 /data/mysql에서 설치를 진행하였습니다)
# mkdir -p /data/mysql
# chown -R mysql:mysql /data/mysql
# chmod 750 /data
7.My.cnf 파일 수정
# vi /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
datadir=/data/mysql
socket=/data/mysql/mysql.sock
[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
log-error=/var/log/mysql/mysql.log
pid-file=/var/run/mysql/mysql.pid
8.mysql_ssl_rsa_setup 수행
/usr/local/mysql/bin 내에 있습니다.
# ./mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
.............................................................+++
.............................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
.........................................................+++
........................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
..................................+++
........................+++
writing new private key to 'client-key.pem'
-----
9.Mysql 생성
# ./mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql
2020-04-22T14:49:33.903889Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-04-22T14:49:33.903978Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.19) initializing of server in progress as process 7950
2020-04-22T14:49:39.272081Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: yaA+R*hqr8wr
10.OS 시스템에 등록
# cp mysql.server /etc/init.d/mysql.server
# chkconfig --add mysql.server
# systemctl start mysql.server
# systemctl status mysql.server
11.접속
# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
위와 같은 에러 발생시 데이터디렉토리에 생성된 mysql.sock파일을 에러에서 말하는 위치로 심볼릭 링크를 생성해줍니다.
# ln -s /data/mysql/mysql.sock /tmp/mysql.sock
# mysql -u root -p
Enter password: yaA+R*hqr8wr
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.19
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
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> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by 'oracle';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
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>
끝
'다른 DBMS > MySQL&MariaDB' 카테고리의 다른 글
My.cnf 시스템 변수 설명 (0) | 2020.12.09 |
---|---|
시스템 변수 변경방법 (0) | 2020.12.08 |
MYSQL설치(RPM) (0) | 2020.12.03 |
MYSQL 설치(YUM) (0) | 2020.12.02 |
Column Size 증가시 테스트 (0) | 2020.10.15 |
댓글