리눅스 MySQL 5.5버전 이상 소스 설치(CMAKE)

1. 필요 패키지 다운로드

1-1 CMAKE

CMAKE 공식 홈페이지 : https://cmake.org/download/

 


1-2 BOOST

https://sourceforge.net/projects/boost/files/boost/

 



1-3 MySQL5.7

MySQL 공식 홈페이지 : https://dev.mysql.com/downloads/mysql/5.7.html#downloads

 


2. 필요 패키지 설치

2-1 CMAKE

 cd /home/server/

 tar -zxvf cmake-3.6.1.tar


 cd cmake-3.6.1

 ./bootstrap  

 make

 make install


2-2 BOOST

 cd /home/server/

 tar -zxvf boost_1_59_0.tar


 cd boot_1_59_0

 ./boots

 ./b2 install


3. MySQL 압축 해제

 cd /home/server/

 tar -zxvf mysql-5.7.24.tar


4. CMAKE 실행

 cd /home/server/mysql-5.7.24

 

 cmake 

-DCMAKE_INSTALL_PREFIX=/home/server/mysql5.7 \

-DWITH_EXTRA_CHARSETS=all \

-DMYSQL_DATADIR=/home/server/mysql5.7/data \

-DENABLED_LOCAL_INFILE=1 \

-DDOWNLOAD_BOOST=1 \

-DWITH_BOOST=../boost_1_59_0 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \

-DSYSCONFDIR=/etc \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS=all


5. make install

 cd /home/server/mysql-5.7.24

 make

 make install


6. 권한 부여

 chown -R mysql.mysql /home/server/mysql-5.7


7. MySQL 초기 세팅 및 임시비밀번호 확인

 cd  /home/server/mysql-5.7/bin

 ./mysqld --initialize --user=mysql --basedir=/home/server/mysql-5.7/ --datadir=/home/server/mysql-5.7/data


2018-12-27T07:56:27.913833Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-12-27T07:56:29.196662Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-12-27T07:56:29.520164Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-12-27T07:56:29.699679Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: eb3a375b-09ac-11e9-8094-782bcb0552a8.

2018-12-27T07:56:29.747774Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2018-12-27T07:56:29.759912Z 1 [Note] A temporary password is generated for root@localhost: 2Dnhu6+d;)HU < 임시비밀번호 


OR 


cat /var/log/mysqld.log | grep 'temporary password'

2018-12-27T07:56:29.759912Z 1 [Note] A temporary password is generated for root@localhost: 2Dnhu6+d;)HU < 임시비밀번호 


8. 설정파일 수정

 cd /etc/

 vi my.cnf

[mysqld]

datadir=/home/server/mysql-5.7/data

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0


[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid


 cd /home/server/mysql-5.7/support-files

 vi mysql.server


 ...

 basedir=/home/server/mysql-5.7

 datadir=/home/server/mysql-5.7/data

 ...



 cp /home/server/mysql-5.7/support-files/mysql.server /etc/init.d/mysqld

 chmod 755 /etc/init.d/mysql.d 


9. 접속 및 초기 비밀번호 설정

 cd /etc/init.d

 ./mysqld start


 cd /home/server/mysql-5.7/bin

 ./mysql  -u root -p

 SET PASSWORD = PASSWORD('your_new_password');



10. 에러 모음

10-1. 서비스 실행 중 mysql.soct 파일 없을 시

  cd /etc/init.d

 ./mysqld start

Starting MySQL.2018-12-27T08:02:26.158618Z mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.

The server quit without updating PID file (/home/server/mys[실패]/data/pushtest2.pid).


cd /var/lib 

 mkdir mysql 

 chown mysql:mysql mysql


 cp /etc/init.d

 ./mysqld start --skip-grant-tables &

 /var/mysql/mysql.soct 파일 생성 확인 


 ./mysqld start 재시작(파일이 생성되어 있으면)

 



+ Recent posts