yum -y install wget gcc* make cmake libtool* openssl* pcre* ncurses ncurses-devel curses-devel libxml* bzip2 bzip2-libs bzip2-devel curl-devel curl expat-devel expat gdbm gdbm-devel libjpeg* libpng* libtiff* freetype* freetype imap imap-devel krb5-devel libmcrypt* libmhash-devel mhash* flex icu libicu libicu-devel libc libcu-devel libc-client-devel zlib-devel zlib libtiff-devel libtiff gd* pcre-devel pcre gdbm* pam-devel patch libcurl libcurl-devel libvpx libvpx-devel libXpm libXpm-devel t1lib t1lib-devel gmp-devel openldap-devel readline-devel libedit-devel libtidy libtidy-devel libxslt libxslt-devel db4-devel ibc-client uw-imap-devel uw-imap uw-imap-static libc-client-2007f wget vim
: 필요없는 라이브러리도 있으니 용량 부족시 확인 후 설치
mysql-3.23.58은 기본이 CentOS 5에서 지원하기 때문에 CentOS 5 에서는 gcc가 기본이 3.4 이다.
CentOS 6에서는 gcc 기본이 4.4 이므로 CentOS5 와 호환성 gcc를 제공한다. gcc3.4로 바꾸어야 CentOS 6 에서 mysql-3.23.58 을 설치 할 수 있다. (즉, CentOS7 에서는 gcc34는 불가입니다. -> CentOS 7 gcc4.4 까지만 지원합니다.)
yum install compat-* --skip-broken
cd /usr/bin
mv gcc gcc-backup
mv g++ g++-backup
ln -s gcc34 gcc
ln -s g++34 g++
- Group & User 생성
groupadd -g 400 mysql
useradd -u400 -g400 -d /usr/local/mysql -s /bin/false mysql
- 파일 다운로드 후 압축 해제
cd /usr/local/src/APM_Setup
wget http://ftp.linux.co.kr/pub/mysql/mysql-3.23.58.tar.gz
tar zxvf mysql-3.23.58.tar.gz
cd mysql-3.23.58
########mysql configure 과정에서 pthread.h 파일을 찾아 위 내용이 있는지 확인하는 것으로 glibc에서 없는 경우 에러 메세지가 난다고 합니다.
echo "/* Linuxthreads */" >> /usr/include/pthread.h
- 컴파일
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-mysqld-user=mysql \
--with-extra-charsets=all \
--enable-thread-safe-client \
--sysconfdir=/etc \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--without-debug \
--enable-shared \
--enable-assembler \
--with-readline \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--with-innodb \
--with-pthread \
--with-named-thread-lib=-lpthread \
--with-charset=euc_kr
- make && make install
make -j 4 && make install
: -j 옵션은 top -> 1로 확인 후 서버에 맞춰 변경하여 사용
- 초기 DB 생성
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --force
- MySQL sock파일 디렉토리생성
mkdir /usr/local/mysql/tmp/
- data 디렉터리 소유권 변경
chown -R mysql.mysql /usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql
chmod 711 /usr/local/mysql
chmod 700 -R /usr/local/mysql/data
chmod 751 /usr/local/mysql/bin
chmod 755 /usr/local/mysql/bin/mysql
chmod 750 /usr/local/mysql/bin/*
chmod 755 /usr/local/mysql/bin/mysqldump
- 환경변수 설정
vi /etc/profile
==============================================
APACHE_HOME=/usr/local/apache
MySQL_HOME=/usr/local/mysql
PHP_HOME=/usr/local/php
PATH=$PATH:$HOME/bin:$APACHE_HOME/bin:$MySQL_HOME/bin:$PHP_HOME/bin:
==============================================
export APACHE_HOME MySQL_HOME PHP_HOME PATH
source /etc/profile
mysql_secure_installation
Set root password? [Y/n] Y
New password: root 패스워드 입력
Re-enter new password: root 패스워드 입력
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
위에 꺼 안될때
/usr/local/mysql/bin/mysqladmin -u root -p password '새로운비밀번호'
- gcc 에러 발생 시
mysql.cc: In function 'void print_table_data(MYSQL_RES*)':
mysql.cc:1650: error: expected primary-expression before '?' token
mysql.cc:1650: error: expected ':' before ')' token
mysql.cc:1650: error: expected primary-expression before ')' token
mysql.cc:1652: error: expected primary-expression before '?' token
mysql.cc:1652: error: expected ':' before ')' token
mysql.cc:1652: error: expected primary-expression before ')' token
mysql.cc:1666: error: expected primary-expression before '?' token
mysql.cc:1666: error: expected ':' before ')' token
mysql.cc:1666: error: expected primary-expression before ')' token
make[1]: *** [mysql.o] Error 1
make[1]: Leaving directory `/usr/local/src/APM_Setup/mysql-4.0.27/client'
make: *** [install-recursive] Error 1
: 위 에러는 gcc 버전이 높아 발생하는 에러로 아래와 같이 해결함
yum install compat-*
cd /usr/bin
mv gcc gcc-backup
mv g++ g++-backup
ln -s gcc34 gcc
ln -s g++34 g++
- LinuxThreads 에러 발생 시
checking “LinuxThreads“… “Not found“
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used. Please install Linuxthreads
(or a new glibc) and try again. See the Installation chapter in the
Reference Manual for more information.
: 위 에러는 glibc를 찾지 못하여 발생하는 에러로 아래와 같이 해결함
vi /usr/include/pthread.h
: 문서 맨 아래에 /* Linuxthreads */를 추가
===
__END_DECLS
#endif /* pthread.h */
/* Linuxthreads */
===
'DB > Mysql' 카테고리의 다른 글
CentOS 7, MySQL 4.0.30 소스 설치 (0) | 2021.11.04 |
---|---|
my.cnf 추천 (0) | 2020.12.02 |
mysql 리플리케이션 무중단 (0) | 2020.11.04 |
mysql8 마이그레이션 (0) | 2020.10.30 |
APM 설치(2/4) - MySQL(5.6.29) (0) | 2020.10.30 |