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

Linux下MySQL 5.5.11 cmake编译安装

第一 预先准备

1?安装所需要系统库相关库文件

gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

2 创建相关目录,下载相关文件,安装文件下载目录 soft ,cmake、mysql5.5 安装文件

[root@nbye?/]#?mkdir -p /usr/soft?

[root@nbye?/]#?cd /usr/soft/

[root@nbye?soft]#?wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

[root@nbye?/]#?wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.11.tar.gz

第二 开始安装

1 安装cmake

[root@nbye?soft]#?tar zxvf cmake-2.8.4.tar.gz

[root@nbye?soft]#? cd cmake-2.8.4

[root@nbye?cmake-2.8.4]#?./configure

[root@nbye?cmake-2.8.4]#? make && make install

?2 安装mysql-5.5.11

[root@nbye?cmake-2.8.4]# cd ../

[root@nbye?soft]#?tar zxvf?mysql-5.5.11.tar.gz

[root@nbye?soft]#?cd?mysql-5.5.11

[root@nbye?/]#?mkdir -p?/usr/local/mysql/

[root@nbye?mysql-5.5.11]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql?-DMYSQL_UNIX_ADDR=/usr/local/mysql/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=/usr/local/mysql/data/mysql?-DMYSQL_USER=mysql?-DMYSQL_TCP_PORT=3306

[root@nbye?mysql-5.5.11]#?make

[root@nbye?mysql-5.5.11]#? make?install

[root@nbye?mysql-5.5.11]#?cp support-files/my-medium.cnf /etc/my.cnf

[root@nbye?mysql-5.5.11]#?chmod 755 /usr/local/mysql/scripts/mysql_install_db

[root@nbye?mysql-5.5.11]# /usr/local/mysql/scripts/mysql_install_db? --user=mysql? --basedir=/usr/local/mysql --datadir=//usr/local/mysql/data/mysql

[root@nbye?/]#?groupadd mysql

[root@nbye?/]#? useradd -g mysql mysql

[root@nbye?/]#? chown mysql.mysql -R?/usr/local/mysql/data/mysql/

3 启动mysql