본문 바로가기

CentOS/TIP

CentOS 6, MySQL 4.0.27 소스 설치

- 기본 준비

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

: 필요없는 라이브러리도 있으니 용량 부족시 확인 후 설치

 

- Group & User 생성

groupadd -g 5100 mysql 

useradd -g mysql mysql

: gid 500이 사용중이므로 5100으로 생성하였음

 

- MySQL 4.0.27 준비

파일 다운로드 후 압축 해제

cd /usr/local/src

wget ~

tar zxvf ~

 

- 컴파일

./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/usr/local/mysql/data --with-mysqld-user=mysqld --with-openssl

 

- make && make install

make -j 4 && make install

: -j 옵션은 top -> 1로 확인 후 서버에 맞춰 변경하여 사용

 

- 설정, 실행파일 생성

cp -arp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

cp -arp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld

 

- data 디렉터리 소유권 변경

chown -R mysql.mysql /usr/local/mysql/data

 

- 환경변수 추가

vi /etc/profilevi /etc

: 문서 맨 하단에 아래 내용 추가

===

export DB_HOME=/usr/local/mysql
export PATH="$PATH:/usr/local/mysql/bin"

===

source /etc/profile

 

- 초기 DB 생성

mysql_install_db

 

- root 비밀번호 설정

mysql_secure_installation

===

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: root 패스워드 입력
Re-enter new password: root 패스워드 입력
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

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
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

===

 

- 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 */

===

 

※ 재시작 및 접속 확인 시 완료

'CentOS > TIP' 카테고리의 다른 글

Zabbix 설치  (0) 2021.01.13
OWASP ZAP 설치(Linux)  (0) 2020.12.14
하나의 서버에서 다른 도메인 SSL 443 포트 사용하기  (0) 2020.09.28
디스크 검사 smartctl  (0) 2020.08.08