日期:2014-05-16  浏览次数:20772 次

linux 下 源码编译 mysql.5.19
今天安装在linux 下安装sphinx 需要支持mysql 的检索功能
安装mysql的rpm 包的时候 sphinx  老是报 mysql-devel 的错误
即使安装了 mysql-devel 的rpm 包也出现同样的问题
下面是用源码编译mysql.5.19的过程
mysql 映像文件地址 http://mysql.mirrors.ilisys.com.au/Downloads/
[root@localhost local]# wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz
[root@localhost local]# tar -zvxf mysql-5.5.19.tar.gz 
[root@localhost local]# cd mysql-5.5.19

安装cmake
(mysql5.5以后是通过cmake来编译的)
下载解压cmake-2.8.4.tar.gz
[root@localhost local] wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz
[root@localhost mysql-5.5.19]# tar zxvf cmake-2.8.4.tar.gz
[root@localhost mysql-5.5.19]# cd cmake-2.8.4
[root@localhost mysql-5.5.19]#./configure
[root@localhost mysql-5.5.19]# make && make install
[root@localhost mysql-5.5.19]# cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 

出现了下面的问题 :
-- MySQL 5.5.19
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake: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/readline.cmake:118 (FIND_CURSES)
  cmake/readline.cmake:214 (MYSQL_USE_BUNDLED_READLINE)
  CMakeLists.txt:257 (MYSQL_CHECK_READLINE)
-- Configuring incomplete, errors occurred!
[root@localhost mysql-5.5.19]# yum install ncurses-devel
[root@localhost mysql-5.5.19]# rm -rf CMakeCache.txt
重新编译安装 
[ 79%] Building C object sql/CMakeFiles/sql.dir/__/sql-common/client.c.o
/mysql-5.5.19/sql-common/client.c:2325: 警告:提领类型双关的指针将破坏强重叠规则
/mysql-5.5.19/sql-common/client.c:2326: 警告:提领类型双关的指针将破坏强重叠规则
/mysql-5.5.19/sql-common/client.c:2327: 警告:提领类型双关的指针将破坏强重叠规则
/mysql-5.5.19/sql-common/client.c: In function ‘run_plugin_auth’:
/mysql-5.5.19/sql-common/client.c:2840: 警告:提领类型双关的指针将破坏强重叠规则
/mysql-5.5.19/sql-common/client.c:2910: 警告:提领类型双关的指针将破坏强重叠规则
[ 79%] Building CXX object sql/CMakeFiles/sql.dir/derror.cc.o
[ 79%] Building CXX object sql/CMakeFiles/sql.dir/des_key_file.cc.o
[ 79%] Building CXX object sql/CMakeFiles/sql.dir/discover.cc.o
[ 79%] Building C object sql/CMakeFiles/sql.dir/__/libmysql/errmsg.c.o
[ 79%] Building CXX object sql/CMakeFiles/sql.dir/field.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/field_conv.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/filesort.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/gstream.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/sha2.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/handler.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/hostname.cc.o
[ 80%] Building CXX object sql/CMakeFiles/sql.dir/init.cc.o
[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item.cc.o
/mysql-5.5.19/sql/item.cc: In member function ‘virtual bool Item_field::fix_fields(THD*, Item**)’:
/mysql-5.5.19/sql/item.cc:4700: 警告:提领类型双关的指针将破坏强重叠规则
[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item_buff.cc.o
[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item_cmpfunc.cc.o
[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item_create.cc.o
[ 81%] Building CXX object sql/CMakeFiles/sql.dir/item_func.cc.o
以上可忽略不计
[root@localhost mysql-5.5.19]# cp  support-files/my-medium.cnf /etc/my.cnf 
赋给文件执行权限
[root@localhost mysql-5.5.19]# chmod 755 script