첫째, 준비 작업
1.1) 소스 패키지
MySQL의-5.6.26.tar.gz
1.2) 해결 종속성
[00:37:56 root@tuxing ~]#yum install -y cmake ncurses-devel
둘째, 소스 설치 MySQL을
1.1) 특정 디렉토리 (/ usr / 지방 /의 SRC)로 압축 해제는
디렉토리에 압축 해제
[11시 42분 54초 루트 @ tuxing 소프트웨어] #tar XF MySQL을 5.6.26.tar.gz -C
/ usr / 지방 / SRC /; CD /usr/local/src/mysql-5.6.26
[11시 42분 59초 루트 @ tuxing mysql을 - 5.6.26] #
1.2)를 MySQL 사용자 만들기
11:42:59 root@tuxing mysql-5.6.26]#useradd -M -s /sbin/nologin mysql
1.3) 컴파일 MySQL의
[11:46:53 root@tuxing mysql-5.6.26]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL-USER=mysql
오류의 경우, 두 단계의 재 컴파일
yum install -y git gcc gcc-c++
rm CMakeCache.txt
직접 실행에 돌아 가기
[11:46:53 root@tuxing mysql-5.6.26]#make -j 2 ; make install
//make过程有点长,我们耐心等待!
1.4) 구성의 MySQL
[11:58:18 root@tuxing ~]#chown -R mysql:mysql /usr/local/mysql/ #属主属组更改
[11:59:10 root@tuxing ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
[11:59:13 root@tuxing ~]# #覆盖原配置文件
[11:59:13 root@tuxing ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#启动脚本
[12:01:42 root@tuxing ~]#vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data #找到并添加
[12:03:29 root@tuxing ~]#chkconfig mysqld on #开机启动
셋째, 데이터베이스를 초기화하는
[12:05:12 root@tuxing ~]#/usr/local/mysql/scripts/mysql_install_db \
--defaults-file=/etc/my.cnf \
--basedir=/usr/local/mysql/ \
--datadir=/usr/local/mysql/data/ \
--user=mysql
두 사람은 성공을 의미 나타나면 ------------------------------ 확인 확인
[12시 5분 12초 루트 tuxing @ ~] 메시지를 디스플레이 는 / usr / / MySQL은 / 데이터 / #의 로컬 테스트 MySQL과 체크
[루트 tuxing 12시 7분 15초 @ ~] #vim /etc/profile.d/mysql 의 .sh # 환경 변수 추가
후속 작업 :
[12:10:11 root@tuxing ~]#source /etc/profile.d/mysql.sh #source一下脚本
[12:11:42 root@tuxing ~]# service mysqld start #启动数据库成功
Starting MySQL. SUCCESS!
[12:11:58 root@tuxing ~]#systemctl start mysqld #centos7.5中启动数据库
[루트 @ 12시 12분 28초 tuxing가
~] # #mysql_secure_installation 초기 보안 설정 암호는 자신으로 설정할 수 있습니다 (루트 암호, 123456 설정), 다른 사람이 직접 입력 할 수 있습니다 [tuxing @ 12시 13분 34초 루트를 ~] #mysql -uroot - p123456 # 로그 (OK)
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.6.26 Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
지금까지의 MySQL의 LNMP가 성공적으로 설치! ! !