CentOS6.7通过cmake编译安装mysql5.5.32

Posted joolearn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.7通过cmake编译安装mysql5.5.32相关的知识,希望对你有一定的参考价值。

Cmake安装mysql-5.5.32

一、查看系统信息

[[email protected] ~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[[email protected] ~]# uname -r

2.6.32-573.el6.x86_64

二、安装环境准备

[[email protected] ~]# mkdir /tools

rz上传cmake、mysql源码包

[[email protected] ~]# ls /tools/

cmake-2.8.8.tar.gz  mysql-5.5.32.tar.gz

[[email protected] tools]# tar xf cmake-2.8.8.tar.gz

[[email protected] tools]# cd cmake-2.8.8

[[email protected] cmake-2.8.8]# ./configure

-- Searching 16 bit integer

-- Check size of unsigned short

-- Check size of unsigned short - done

-- Using unsigned short

-- Check if the system is big endian - little endian

-- Looking for wsyncup in /usr/lib64/libcurses.so

-- Looking for wsyncup in /usr/lib64/libcurses.so - found

-- Looking for elf.h

-- Looking for elf.h - found

-- Enable ninja generator.

-- Looking for a Fortran compiler

-- Looking for a Fortran compiler - /usr/bin/f95

-- Could NOT find Qt4 (missing:  QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY)

-- Configuring done

-- Generating done

-- Build files have been written to: /tools/cmake-2.8.8

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

CMake has bootstrapped.  Now run gmake.

[[email protected] cmake-2.8.8]# gmake

[ 99%] Built target CMakeLibTests

Scanning dependencies of target runcompilecommands

[100%] Building CXX object Tests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o

Linking CXX executable runcompilecommands

[100%] Built target runcompilecommands

Scanning dependencies of target foo

[100%] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o

Linking CXX static library libfoo.a

[100%] Built target foo

 

[[email protected] cmake-2.8.8]# gmake install

-- Installing: /usr/local/doc/cmake-2.8/cmake-policies.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-properties.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-variables.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-modules.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-commands.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-compatcommands.txt

-- Installing: /usr/local/doc/cmake-2.8/ctest.txt

-- Installing: /usr/local/doc/cmake-2.8/ctest.docbook

-- Installing: /usr/local/doc/cmake-2.8/cpack.txt

-- Installing: /usr/local/doc/cmake-2.8/cpack.docbook

-- Installing: /usr/local/doc/cmake-2.8/ccmake.txt

-- Installing: /usr/local/doc/cmake-2.8/ccmake.docbook

-- Installing: /usr/local/share/aclocal/cmake.m4

[[email protected] cmake-2.8.8]# echo $?     

0    #####验证安装成功

Cmake安装成功,下一步安装mysql,首先安装mysql依赖包

[[email protected] cmake-2.8.8]# yum -y install ncurses-devel libaio-devel

[[email protected] ~]# useradd mysql -s /sbin/nologin -M

[[email protected] tools]# tar xf mysql-5.5.32.tar.gz

[[email protected] tools]# ls

cmake-2.8.8  cmake-2.8.8.tar.gz  mysql-5.5.32  mysql-5.5.32.tar.gz

[[email protected] tools]# cd mysql-5.5.32

[[email protected] mysql-5.5.32]# cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql-5.5.32

> -DMYSQL_DATADIR=/app/mysql-5.5.32/data

> -DMYSQL_UNIX_ADDR=/app/mysql-5.5.32/tmp/mysql.sock

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

 

-- Found Curses: /usr/lib64/libcurses.so 

-- Looking for tputs in /usr/lib64/libcurses.so

-- Looking for tputs in /usr/lib64/libcurses.so - found

-- Looking for include file libaio.h

-- Looking for include file libaio.h - found

-- Looking for io_queue_init in aio

-- Looking for io_queue_init in aio - found

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success

-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC

-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success

-- Check size of pthread_t

-- Check size of pthread_t - done

-- Performing Test HAVE_PEERCRED

-- Performing Test HAVE_PEERCRED - Success

-- Configuring done

-- Generating done

-- Build files have been written to: /tools/mysql-5.5.32

[[email protected] mysql-5.5.32]#

[[email protected] mysql-5.5.32]# make && make install

 

-- Installing: /app/mysql-5.5.32/man/man1/mysql_find_rows.1

-- Installing: /app/mysql-5.5.32/man/man1/myisamchk.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_install_db.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql.server.1

-- Installing: /app/mysql-5.5.32/man/man1/myisam_ftdump.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqlslap.1

-- Installing: /app/mysql-5.5.32/man/man1/comp_err.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_plugin.1

-- Installing: /app/mysql-5.5.32/man/man1/my_print_defaults.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqladmin.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqlbinlog.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_fix_extensions.1

-- Installing: /app/mysql-5.5.32/man/man1/resolve_stack_dump.1

-- Installing: /app/mysql-5.5.32/man/man8/mysqld.8

-- Installing: /app/mysql-5.5.32/support-files/solaris/postinstall-solaris

 

安装成功后,创建软连接

 [[email protected] /]# ln -s /app/mysql-5.5.32/ /app/mysql 

[[email protected] /]# ll /app

total 4

lrwxrwxrwx  1 root root   18 Sep  8 14:53 mysql -> /app/mysql-5.5.32/

drwxr-xr-x 13 root root 4096 Sep  8 14:51 mysql-5.5.32

备份my.cnf

[[email protected] /]# ls /etc/my.cnf

/etc/my.cnf

[[email protected] /]# mv /etc/my.cnf /etc/my.cnf.bak

[[email protected] mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

[[email protected] mysql-5.5.32]# chown -R mysql.mysql /app/mysql/data

###授权mysql管理

[[email protected] mysql-5.5.32]#echo ‘PAHT=/app/mysql/bin:$PATH‘ >> /etc/profile

[[email protected] mysql-5.5.32]#.  /etc/profile

###修改全局路径,并生效

下一步初始化数据库

[[email protected] mysql-5.5.32]# cd /app/mysql/scripts/

[[email protected] scripts]# ./mysql_install_db  --basedir=/app/mysql --datadir=/app/mysql/data/ --user=mysql

#####加./ 是为了避免初始化过程中系统执行默认路径的mysql_install_db

WARNING: The host ‘mysql‘ could not be looked up with resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...

OK

Filling help tables...

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

 

/app/mysql/bin/mysqladmin -u root password ‘new-password‘

/app/mysql/bin/mysqladmin -u root -h mysql password ‘new-password‘

 

Alternatively you can run:

/app/mysql/bin/mysql_secure_installation

 

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

cd /app/mysql ; /app/mysql/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd /app/mysql/mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /app/mysql/scripts/mysqlbug script!

出现两个ok代表初始化成功

[[email protected] scripts]# cd /tools/mysql-5.5.32

[[email protected] mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

[[email protected] mysql-5.5.32]# chmod +x /etc/init.d/mysqld

[[email protected] mysql-5.5.32]# /etc/init.d/mysqld start

Starting MySQL...                                  

 

Mysql安装完毕,并启动成功

 

 

 

Cmake安装mysql-5.5.32

一、查看系统信息

[[email protected] ~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[[email protected] ~]# uname -r

2.6.32-573.el6.x86_64

二、安装环境准备

[[email protected] ~]# mkdir /tools

rz上传cmake、mysql源码包

[[email protected] ~]# ls /tools/

cmake-2.8.8.tar.gz  mysql-5.5.32.tar.gz

[[email protected] tools]# tar xf cmake-2.8.8.tar.gz

[[email protected] tools]# cd cmake-2.8.8

[[email protected] cmake-2.8.8]# ./configure

-- Searching 16 bit integer

-- Check size of unsigned short

-- Check size of unsigned short - done

-- Using unsigned short

-- Check if the system is big endian - little endian

-- Looking for wsyncup in /usr/lib64/libcurses.so

-- Looking for wsyncup in /usr/lib64/libcurses.so - found

-- Looking for elf.h

-- Looking for elf.h - found

-- Enable ninja generator.

-- Looking for a Fortran compiler

-- Looking for a Fortran compiler - /usr/bin/f95

-- Could NOT find Qt4 (missing:  QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY)

-- Configuring done

-- Generating done

-- Build files have been written to: /tools/cmake-2.8.8

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

CMake has bootstrapped.  Now run gmake.

[[email protected] cmake-2.8.8]# gmake

[ 99%] Built target CMakeLibTests

Scanning dependencies of target runcompilecommands

[100%] Building CXX object Tests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o

Linking CXX executable runcompilecommands

[100%] Built target runcompilecommands

Scanning dependencies of target foo

[100%] Building CXX object Tests/FindPackageModeMakefileTest/CMakeFiles/foo.dir/foo.cpp.o

Linking CXX static library libfoo.a

[100%] Built target foo

 

[[email protected] cmake-2.8.8]# gmake install

-- Installing: /usr/local/doc/cmake-2.8/cmake-policies.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-properties.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-variables.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-modules.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-commands.txt

-- Installing: /usr/local/doc/cmake-2.8/cmake-compatcommands.txt

-- Installing: /usr/local/doc/cmake-2.8/ctest.txt

-- Installing: /usr/local/doc/cmake-2.8/ctest.docbook

-- Installing: /usr/local/doc/cmake-2.8/cpack.txt

-- Installing: /usr/local/doc/cmake-2.8/cpack.docbook

-- Installing: /usr/local/doc/cmake-2.8/ccmake.txt

-- Installing: /usr/local/doc/cmake-2.8/ccmake.docbook

-- Installing: /usr/local/share/aclocal/cmake.m4

[[email protected] cmake-2.8.8]# echo $?     

0    #####验证安装成功

Cmake安装成功,下一步安装mysql,首先安装mysql依赖包

[[email protected] cmake-2.8.8]# yum -y install ncurses-devel libaio-devel

[[email protected] ~]# useradd mysql -s /sbin/nologin -M

[[email protected] tools]# tar xf mysql-5.5.32.tar.gz

[[email protected] tools]# ls

cmake-2.8.8  cmake-2.8.8.tar.gz  mysql-5.5.32  mysql-5.5.32.tar.gz

[[email protected] tools]# cd mysql-5.5.32

[[email protected] mysql-5.5.32]# cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql-5.5.32

> -DMYSQL_DATADIR=/app/mysql-5.5.32/data

> -DMYSQL_UNIX_ADDR=/app/mysql-5.5.32/tmp/mysql.sock

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

 

-- Found Curses: /usr/lib64/libcurses.so 

-- Looking for tputs in /usr/lib64/libcurses.so

-- Looking for tputs in /usr/lib64/libcurses.so - found

-- Looking for include file libaio.h

-- Looking for include file libaio.h - found

-- Looking for io_queue_init in aio

-- Looking for io_queue_init in aio - found

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success

-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC

-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success

-- Check size of pthread_t

-- Check size of pthread_t - done

-- Performing Test HAVE_PEERCRED

-- Performing Test HAVE_PEERCRED - Success

-- Configuring done

-- Generating done

-- Build files have been written to: /tools/mysql-5.5.32

[[email protected] mysql-5.5.32]#

[[email protected] mysql-5.5.32]# make && make install

 

-- Installing: /app/mysql-5.5.32/man/man1/mysql_find_rows.1

-- Installing: /app/mysql-5.5.32/man/man1/myisamchk.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_install_db.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql.server.1

-- Installing: /app/mysql-5.5.32/man/man1/myisam_ftdump.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqlslap.1

-- Installing: /app/mysql-5.5.32/man/man1/comp_err.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_plugin.1

-- Installing: /app/mysql-5.5.32/man/man1/my_print_defaults.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqladmin.1

-- Installing: /app/mysql-5.5.32/man/man1/mysqlbinlog.1

-- Installing: /app/mysql-5.5.32/man/man1/mysql_fix_extensions.1

-- Installing: /app/mysql-5.5.32/man/man1/resolve_stack_dump.1

-- Installing: /app/mysql-5.5.32/man/man8/mysqld.8

-- Installing: /app/mysql-5.5.32/support-files/solaris/postinstall-solaris

 

安装成功后,创建软连接

 [[email protected] /]# ln -s /app/mysql-5.5.32/ /app/mysql 

[[email protected] /]# ll /app

total 4

lrwxrwxrwx  1 root root   18 Sep  8 14:53 mysql -> /app/mysql-5.5.32/

drwxr-xr-x 13 root root 4096 Sep  8 14:51 mysql-5.5.32

备份my.cnf

[[email protected] /]# ls /etc/my.cnf

/etc/my.cnf

[[email protected] /]# mv /etc/my.cnf /etc/my.cnf.bak

[[email protected] mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

[[email protected] mysql-5.5.32]# chown -R mysql.mysql /app/mysql/data

###授权mysql管理

[[email protected] mysql-5.5.32]#echo ‘PAHT=/app/mysql/bin:$PATH‘ >> /etc/profile

[[email protected] mysql-5.5.32]#.  /etc/profile

###修改全局路径,并生效

下一步初始化数据库

[[email protected] mysql-5.5.32]# cd /app/mysql/scripts/

[[email protected] scripts]# ./mysql_install_db  --basedir=/app/mysql --datadir=/app/mysql/data/ --user=mysql

#####加./ 是为了避免初始化过程中系统执行默认路径的mysql_install_db

WARNING: The host ‘mysql‘ could not be looked up with resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...

OK

Filling help tables...

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

 

/app/mysql/bin/mysqladmin -u root password ‘new-password‘

/app/mysql/bin/mysqladmin -u root -h mysql password ‘new-password‘

 

Alternatively you can run:

/app/mysql/bin/mysql_secure_installation

 

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

cd /app/mysql ; /app/mysql/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd /app/mysql/mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /app/mysql/scripts/mysqlbug script!

出现两个ok代表初始化成功

[[email protected] scripts]# cd /tools/mysql-5.5.32

[[email protected] mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

[[email protected] mysql-5.5.32]# chmod +x /etc/init.d/mysqld

[[email protected] mysql-5.5.32]# /etc/init.d/mysqld start

Starting MySQL...                                  

 

Mysql安装完毕,并启动成功

 

以上是关于CentOS6.7通过cmake编译安装mysql5.5.32的主要内容,如果未能解决你的问题,请参考以下文章

centos6.7编译安装mysql5.7.17

CentOS6.7 Mysql5.6.35版本 源码编译+Mysql数据库忘记root密码如何修改

centos6.7下 编译安装MySQL5.7

在CentOS6.7操作系统上编译安装mysql-5.6.31

mysql5.5.22编译安装

mysql的安装配置