2022이전/Linux

mysql 5.6.31 소스설치

바로퇴장 2021. 9. 15. 18:56

 

yum install -y gcc* ncurses-devel cmake

# 소스 설치
cd /usr/local/src/
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.31.tar.gz
tar zxvpf mysql-5.6.31.tar.gz
cd mysql-5.6.31

#설치 위치 /usr/local/mysql
#데이터 위치 /data
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 -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci

make && make install

#다른 서버의 설정값 복사
vi /etc/my.cnf 

#계정 생성
groupadd -g 400 mysql
useradd -u400 -g400 -d /usr/local/mysql -s /bin/false mysql

#만약 없다면
cd /usr/local/mysql
cp -arp support-files/my-default.cnf /etc/my.cnf

# 실행 설정
cp -arp support-files/mysql.server /etc/init.d/mysqld

# 초기 설정
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/ --basedir=/usr/local/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
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld

#시작하기
systemctl start mysql

#에러시
cat /data/[서버명].err

 

출처 https://yumserv.tistory.com/115