원본 컴파일 mysql 5.5 + 설치 과정 전체 기록

선언: mysql 5.5 버전부터 mysql 원본 설치는 cmake를 사용하기 시작했습니다. 컴파일 설치는 이전 버전과 좀 달라졌습니다.
1. 설치 단계:
    1.사전 설치 준비
a. mysql 소스 코드 패키지를 다운로드하고 mysql 다운로드 페이지에서 MYSQL Community Serve Source Code 버전 선택
참고: Linux-Generic 버전을 선택하지 마십시오. 이 버전은 컴파일된 바이너리 버전입니다.
b. 리눅스가 make,bison,cmake,gcc-c++,ncurses가 설치되어 있는지 확인합니다. 설치되지 않은 경우 위 패키지를 먼저 설치하고 설치 방법은 다음과 같습니다.
주의: 일반 시스템에는make, gcc-c++가 기본적으로 설치되어 있습니다.
         1.make 컴파일러 설치
다운로드 주소:http://www.gnu.org/software/make/
# tar zxvf make-3.82.tar.gz  
# cd make-3.82  
# ./configure  
# make  
# make install 

사용 가능: yum install make.i686 패키지 설치
        
       2.bison 설치
다운로드 주소:http://www.gnu.org/software/bison/      
<span style="font-size:13px;"># tar zxvf bison-2.5.tar.gz  
# cd bison-2.5  
# ./configure  
# make  
# make install </span>

사용 가능: yum install bison.i686 패키지 설치
3. gcc-c++ 설치
다운로드 주소:http://www.gnu.org/software/gcc
# tar zxvf gcc-c++-4.4.4.tar.gz  
# cd gcc-c++-4.4.4  
# ./configure  
# make  
# make install

사용 가능: yum install gcc-c++.i686 패키지 설치
4. cmake 설치
다운로드 주소:http://www.cmake.org/
# tar zxvf cmake-2.8.4.tar.gz  
# cd cmake-2.8.4  
# ./configure  
# make  
# make install

사용 가능: yum install cmake.i686 패키지 설치
         
5. ncurses 설치
다운로드 주소:http://www.gnu.org/software/ncurses/
# tar zxvf ncurses-5.8.tar.gz  
# cd ncurses-5.8  
# ./configure  
# make  
# make install

사용 가능: yum install ncurses.i686 패키지 설치
         2.mysql 사용자 및 그룹 추가
#groupadd mysql
#useradd -g mysql -s /sbin/nologin -M mysql


         3.mysql의 원본 코드 컴파일
#tar zxvf mysql-5.5.13.tar.gz
#cd mysql-5.5.13
#rm CMakeCache.txt
#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql55/  -DMYSQL_DATADIR=/usr/local/mysql55/data  -DWITH_INNOBASE_STORAGE_ENGINE=1  -DMYSQL_TCP_PORT=3306  -DMYSQL_UNIX_ADDR=/usr/local/mysql55/data/mysql.sock  -DMYSQL_USER=mysql  -DWITH_DEBUG=0
#make 
#make install

       4.컴파일 완료 후 데이터베이스 설치
# cd /usr/local/mysql  
# chown -R mysql .  
# chgrp -R mysql .  
# scripts/mysql_install_db --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# chown -R root . 
# chown -R mysql ./data

데이터베이스를 설치한 후 데이터베이스를 시작할 수 없습니다. 로그 보기: Can't open the mysql.plugin table...2009-06-01 00:52Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
해결 방법: 데이터베이스 설치 프로세스를 다시 실행하고
그리하여 해결하다
   5.다음 명령은 선택할 수 있습니다. mysql 프로필을/etc로 복사합니다.
cp support-files/my-medium.cnf/etc/my.cnf
만약 원래의/etc 디렉터리에 my가 있다면.cnf 파일은 설치된 my를 컴파일해야 합니다.cnf 시스템 기본 my를 교체합니다.cnf, 그렇지 않으면 다음과 같은 오류가 발생합니다.
--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

       6.mysql를 시작하려면:
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
120406 23:57:45 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120406 23:57:45 InnoDB: The InnoDB memory heap is disabled
120406 23:57:45 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120406 23:57:45 InnoDB: Compressed tables use zlib 1.2.3
120406 23:57:45 InnoDB: Initializing buffer pool, size = 128.0M
120406 23:57:45 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
120406 23:57:45  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
120406 23:57:45  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
120406 23:57:45  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
120406 23:57:46  InnoDB: Waiting for the background threads to start
120406 23:57:47 InnoDB: 1.1.8 started; log sequence number 0
120406 23:57:47 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
120406 23:57:47 [ERROR] Can't start server: can't create PID file: No such file or directory
120406 23:57:47 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

옵션 단계: 루트 암호를 설정하려면:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'  
이 단계는 데이터베이스가 시작된 후에야 실행할 수 있습니다
  7.시작 구성
# bin/mysqld_safe --user=mysql &  
# #  mysql,       
# netstat -tnl|grep 3306
#   
# ps -aux|grep 'mysql'

또는 다음과 같이 시작합니다.
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig –add mysqld

8
# # mysql               
# cp support-files/mysql.server /etc/init.d/mysql.server  
# #             mysql  
# service mysql.server start  
# #  mysql    
# service mysql.server stop  
# #  mysql    
# service mysql.server restart 
     
부록:
재컴파일 문제 정보:
Dealing with Problems Compiling MySQL
The solution to many problems involves reconfiguring. If you do reconfigure, take note of the following:
  • If CMake is run after it has previously been run,it may use information that was gathered during its previousinvocation. This information is stored in CMakeCache.txt . WhenCMakestarts up, it looks for that file and reads its contents if it exists,on the assumption that the information is still correct. Thatassumption is invalid when you reconfigure.
  • Each time you run CMake, you must run makeagain to recompile. However, you may want to remove old object filesfrom previous builds first because they were compiled using differentconfiguration options.

  • To prevent old object files or configuration information from being used, run these commands on Unix before re-runningCMake:
        , mysql  bin    PATH 
    export PATH=/usr/local/mysql/bin:$PATH
    

    좋은 웹페이지 즐겨찾기