cmake编译mysql_linux下使用cmake编译安装mysql的详细教程

一、安装cmake

1、解压cmake压缩包

[root@mysql tools]# tar -zvxf cmake-2.8.8.tar.gz

[root@mysql tools]# ls

cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16.tar.gz scripts

2、解析

[root@mysql tools]# cd cmake-2.8.8

[root@mysql cmake-2.8.8]# ./configure

---------------------------------------------

CMake 2.8.8, Copyright 2000-2009 Kitware, Inc.

Found GNU toolchain

C compiler on this system is: gcc

C++ compiler on this system is: g++

Makefile processor on this system is: gmake

g++ is GNU compiler

g++ has STL in std:: namespace

g++ has ANSI streams

g++ has streams in std:: namespace

3、安装

[root@mysql cmake-2.8.8]# echo $?

0

#如果返回值是0,就是执行成功,如果返回值是1,就是执行失败;

[root@mysql cmake-2.8.8]# gmake && gmake install

Scanning dependencies of target cmIML_test

[ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test.c.o

[ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_C.c.o

[ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_C.c.o

[ 1%] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_C.c.o

[ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_CXX.cxx.o

[ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_CXX.cxx.o

[ 2%] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_CXX.cxx.o

二、开始安装mysql

1、首先需要安装(ncurses-devel)依赖包

[root@mysql cmake-2.8.8]# cd …

[root@mysql tools]# yum -y install ncurses-devel

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

base: mirrors.zju.edu.cn

extras: centos.ustc.edu.cn

updates: mirrors.zju.edu.cn

Resolving Dependencies

–> Running transaction check

—> tools ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed

#############安装完成后检查###########

[root@mysql tools]# rpm -qa | grep ncurses-devel

ncurses-devel-5.9-14.20130511.el7_4.x86_64

[root@mysql tools]#

2、解压mysql压缩包

[root@mysql tools]# tar -zvxf mysql-5.5.16.tar.gz

[root@mysql tools]# ls

cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16 mysql-5.5.16.tar.gz scripts

[root@mysql tools]#

3、创建虚拟用户

[root@mysql tools]# useradd mysql -s /sbin/nologin -M

[root@mysql tools]# id mysql

uid=1000(mysql) gid=1000(mysql) groups=1000(mysql)

[root@mysql tools]#

4、配置解析

[root@mysql tools]# cd mysql-5.5.16

[root@mysql mysql-5.5.16]#

[root@mysql mysql-5.5.16]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.16 -DMYSQL_DATADIR=/usr/local/mysql-5.5.16/data -DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.16/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值