首页mysql › mysql 5.5 源码安装

mysql 5.5 源码安装

mysql 5.5 源码安装方法

1.安装cmake
1)下载cmake
#wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
2)解压cmake
#tar -zvxf cmake-2.8.3.tar.gz
3)配置编译
#cd cmake-2.8.3
#yum -y install gcc
#yum -y install gcc-c++
#./configure
#make
#make install

2.安装MYSQL
1)下载MYSQL
mkdir /opt/mysql_src
#cd /opt/mysql_src
#wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.14.tar.gz/from/http://mysql.mirror.rafal.ca/
2)解压mysql-5.5.14.tar.gz
#tar -zvxf mysql-5.5.14.tar.gz

创建目录(mysql5.5默认已经没有data目录了)
mkdir -p /opt/mysql_src/product
mkdir -p /opt/mysql_src/data

3)配置编译
#cd mysql-5.5.14
#cmake . ##这个方法,安装路径默认

#cmake . \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/mysql_src/product \
-DCOMMUNITY_BUILD:BOOL=ON \
-DENABLED_PROFILING:BOOL=ON \
-DENABLE_DEBUG_SYNC:BOOL=OFF \
-DINSTALL_LAYOUT:STRING=STANDALONE \
-DMYSQL_DATADIR:PATH=/opt/mysql_src/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

如果出现一下错误:
cmake .
– MySQL 5.5.14
– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (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:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

– Configuring incomplete, errors occurred!

需要安装ncurses-devel包
# yum -y install ncurses-devel

#make
#make install

#groupadd mysql
#useradd -r -g mysql mysql
#cd /opt/mysql_sc
#chown -R mysql:mysql .
#scripts/mysql_install_db –user=mysql
添加标准/etc/my.cnf文件(见mysql二进制安装程序,修改相关路径)
#./bin/mysqld_safe –user=mysql &

发表评论