메뉴 닫기

CentOS7에서 Mysql 8.0 소스 설치

1. 버전 확인

# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

2. 필수 패키지 설치

# yum -y install cmake ncurses-devel gcc* openssl openssl-devel

3. MySQL 설치

  • 계정 추가
# groupadd -g 400 mysql
# useradd -u400 -g400 -d /usr/local/mysql -s /bin/false mysql
  • 설치

# cd /usr/local/src
# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11.tar.gz
# tar xvfz mysql-8.0.11.tar.gz
# cd mysql-8.0.11v
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DWITH_SSL=system -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/include/boost

# make && make install

  •  초기 데이터 베이스 구성 및 권한 설정
# /usr/local/mysql/bin/mysqld –initialize-insecure –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –user=mysql
# chown -R mysql.mysql /usr/local/mysql/
# chmod 711 /usr/local/mysql
# chmod 700 /usr/local/mysql/data
# chmod 751 /usr/local/mysql/bin/
# chmod 750 /usr/local/mysql/bin/*
# chmod 755 /usr/local/mysql/bin/mysql
# chmod 755 /usr/local/mysql/bin/mysqldump
  • boost 설치
# cd /usr/local/include/boost/boost_1_66_0
# ./bootstrap.sh
# ./b2 install
  • 자동 실행 설정 및 기타 파일 적용

# vi /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql/
port=3306
socket=/tmp/mysql.sock

[mysqld_safe]
log-error=/var/log/mysql_log.err
pid-file=/usr/local/mysql/mysql.pid

# cp -arp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# chkconfig –add mysqld
# chkconfig mysqld on

  • 방화벽 추가

# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 33060 -j ACCEPT

# service iptables restart
Redirecting to /bin/systemctl restart iptables.service

# iptables -nL | grep 3306
ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306
ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:33060

 

  • 설치 확인 및 버전 확인

# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
# netstat -nltp | grep mysqld
tcp6 0 0 :::33060 :::* LISTEN 26237/mysqld
tcp6 0 0 :::3306 :::* LISTEN 26237/mysqld

# mysql -V
/usr/local/mysql/bin/mysql Ver 8.0.11 for Linux on x86_64 (Source distribution)

 

mysql 비번 번경

-초기 데이터 베이스 구성 시 –initialize-insecure 옵션을 쓰면서 root 패스워드를 입력시키지 않게 설정해놓았습니다.

-처음 MYSQL 접속시에는 비밀번호가 없으므로, 바로 접속 후에 비밀번호를 수정해줍니다.

 

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘비밀번호’;
Query OK, 0 rows affected (0.04 sec)

 

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x