linux 环境:
CentOS release 6.4 (Final)
2.6.32-358.el6.x86_64
cmake 版本:
cmake-2.8.3
mysql版本:
mysql-5.5.32
注:以下操作的安装包默认都下载到了/application/tools下
安装cmake
tar zxf cmake-2.8.3.tar.gz cd cmake-2.8.3 ./configure make && make install cd ..
安装mysql
####创建数据目录(mysql5.5默认已经没有data目录了)####
mkdir /application/mysql-5.5.32/data -p
####创建mysql用户和组####
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin -M
####编译安装####
tar zxf mysql-5.5.32.tar.gz cd mysql-5.5.32 cmake . \ -DCMAKE_BUILD_TYPE:STRING=Release \ -DCMAKE_INSTALL_PREFIX:PATH=/application/mysql-5.5.32 \ -DCOMMUNITY_BUILD:BOOL=ON \ -DENABLED_PROFILING:BOOL=ON \ -DENABLE_DEBUG_SYNC:BOOL=OFF \ -DINSTALL_LAYOUT:STRING=STANDALONE \ -DMYSQL_DATADIR:PATH=/application/mysql-5.5.32/data \ -DMYSQL_MAINTAINER_MODE:BOOL=OFF \ -DWITH_EMBEDDED_SERVER:BOOL=ON \ -DWITH_EXTRA_CHARSETS:STRING=all \ -DWITH_SSL:STRING=bundled \ -DWITH_UNIT_TESTS:BOOL=OFF \ -DWITH_ZLIB:STRING=bundled \ -LH make make install
#注:cmake参数参考地址:
http://www.blogjava.net/kelly859/archive/2012/09/04/387005.html
####创建软链接,更改属主####
ln -s /application/mysql-5.5.32/ /application/mysql
chown -R mysql /application/mysql
####mysql初始化####
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
####拷贝mysql配置文件####
cp /application/tools/mysql-5.5.32/support-files/my-medium.cnf /etc/my.cnf
####拷贝启动脚本,并更改其700权限####
cp /application/tools/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
####启动mysql####
/etc/init.d/mysqld start
####检查mysql是否启动####
[root@mysql support-files]# lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 27792 mysql 11u IPv4 88514 0t0 TCP *:mysql (LISTEN)
[root@mysql support-files]# netstat -lnput |grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 27792/mysqld
####登录mysql####
[root@mysql support-files]# /application/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32-log Source distribution
Copyright (c) 2000, 2013, 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>
#cmake -LH错误:
-- Running cmake version 2.8.3
-- MySQL 5.5.32
-- Packaging as: mysql-5.5.32-Linux-x86_64
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readlineNaNake:83 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readlineNaNake:127 (FIND_CURSES)
cmake/readlineNaNake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:269 (MYSQL_CHECK_READLINE)
-- Configuring incomplete, errors occurred!
解决方法:
yum -y install ncurses-devel
安装完ncurses-devel 包后在mysql解压包下操作:
make clean
rm -f CMakeCache.txt
cmake . -LH