mysql从5.5之后源码安装需要使用cmake:
To install MySQL from source, your system must have the following tools, regardless of installation method:
CMake, which is used as the build framework on all platforms.CMake can be downloaded fromhttp://www.cmake.org.
A good make program. Although some platforms come with their ownmake implementations, it is highly recommended that you use GNUmake 3.75 or newer. It may already be available on your system asgmake. GNUmake is available fromhttp://www.gnu.org/software/make/.
A working ANSI C++ compiler. GCC 4.2.1 or later, Sun Studio 10 or later, Visual Studio 2008 or later, and many current vendor-supplied compilers are known to work.
Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. On Windows, you can use a version such as ActiveState Perl.
yum 安装 gcc,gcc-c++,cmake,bison(GNU),使用 centos6.0 自带的perl和openssl
添加mysql组和mysql用户
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
将mysql和data文件安装到不同的物理磁盘上
cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/mysql \
-DMYSQL_DATADIR=/home/soft/mysql/data \
-DMYSQL_UNIX_ADDR=/opt/soft/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=0 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0 \
-DWITH_SSL=yes
报错:
-- 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安装之后 还是报错,找运维高手才知道 cmake会产生CMakeCache.txt文件,每次cmake之前需要删除它....
ok,一切正常
echo $?
输出结果为0
make
make install
安装成功
chown mysql:mysql /home/soft/mysql -R
chown msyql:mysql /opt/soft/mysql/ -R
初始化数据库
/opt/soft/mysql/scripts/mysql_install_db \--defaults-file=/opt/soft/mysql/config/my.cnf \ --basedir=/opt/soft/mysql\ --datadir=/home/soft/mysql/data \ --user=mysql
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