Home  >  Article  >  Database  >  centos下MySQL 5.5.11 CMake安装笔记_MySQL

centos下MySQL 5.5.11 CMake安装笔记_MySQL

WBOY
WBOYOriginal
2016-06-01 13:38:541157browse

CentOS

bitsCN.com


centos下MySQL 5.5.11 CMake安装笔记

 

mysql 最新的版本都需要cmake编译安装,估计以后的版本也会采用这种方式,所以特地记录一下安装步骤及过程,以供参考。

注意: 此安装是默认centos下已经安装了最新工具包,比如GNU make , GCC , Perl , libncurses5-dev ,如果在编译安装过程中发现有缺失的工具包,先yum install 单独下载安装再继续即可。

一. Centos 用 wget 下载需要的软件,保存到目录 /usr/local/src/ 下 

wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.11.tar.gz/from/http://mysql.he.net/

wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

wget http://ftp.gnu.org/gnu/bison/bison-2.4.3.tar.gz

二. 安装 cmake

cd /usr/local/src

tar zxvf cmake-2.8.4.tar.gz 

cd cmake-2.8.4 

./bootstrap 

gmake 

gmake install 

cd ../ 

tar zxvf bison-2.4.3.tar.gz 

cd bison-2.4.3 

./configure 

make 

make install

cd ../
 

三. 编译安装 MySQL 5.5.11 

/usr/sbin/groupadd mysql 

/usr/sbin/useradd -g mysql mysql 

tar xvf mysql-5.5.11.tar.gz 

cd mysql-5.5.11/ 

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql / 

-DMYSQL_UNIX_ADDR=/tmp/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=/var/mysql/data / 

-DMYSQL_USER=mysql 

make 

make install 

chmod +w /usr/local/mysql 

chown -R mysql:mysql /usr/local/mysql 

ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16

mkdir -p /var/mysql/ 

mkdir -p /var/mysql/data/ 

mkdir -p /var/mysql/log/ 

chown -R mysql:mysql /var/mysql/

cdsupport-files/

cpmy-large.cnf /var/mysql/my.cnf

cp mysql.server /etc/init.d/mysqld
 

四. 配置启动MySQL 5.5.11

1. 若有需要请先修改 mysql 的配置 my.cnf

vi /var/mysql/my.cnf

2. mysql 初始化安装

/usr/local/mysql/scripts/mysql_install_db / 

--defaults-file=/var/mysql/my.cnf / 

--basedir=/usr/local/mysql / 

--datadir=/var/mysql/data / 

--user=mysql
 

3. 将 mysql 加入开机启动

chmod +x /etc/init.d/mysqld 

vi /etc/init.d/mysqld (编辑此文件,查找并修改以下变量内容:) 

basedir=/usr/local/mysql 

datadir=/var/mysql/data

chkconfig --add mysqld 

chkconfig --level 345 mysqld on 

4. 启动 mysql

service mysqld start

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn