---
title: "Centos 6.3 下编译安装MySQL 5.5.24"
author: "dogg"
date: "2011-06-13T14:47:47Z"
tags: []
categories: ["操作系统"]
slug: "centos-6-3-mysql-5-5-24"
draft: false
lastmod: "2012-08-17T15:58:45Z"
id: 1084058
url: "https://ykf.iteye.com/blog/1084058"
---

网上搜到的不是老掉牙的就是不完整的，一下操作只适用于标题所指版本，版本不同，安装方式是有可能不同的。

1.cmake

 

wget [http://www.cmake.org/files/v2.8/cmake-2.8.9.tar.gz](http://www.cmake.org/files/v2.8/cmake-2.8.9.tar.gz)

 

tar zxvf cmake-2.8.9.tar.gz

cd cmake-2.8.9

./bootstrap

gmake

gmake install

cd ../

 

2.mysql

yum install bison ncurses-devel

tar zxvf mysql-5.5.25.tar.gz

cd mysql-5.5.25

cmake -DCMAKE\_INSTALL\_PREFIX=/usr/local/mysql -DMYSQL\_DATADIR=/usr/local/mysql/data -DWITH\_MYISAM\_STORAGE\_ENGINE=1 -DWITH\_INNOBASE\_STORAGE\_ENGINE=1 -DWITH\_ARCHIVE\_STORAGE\_ENGINE=1 -DWITH\_BLACKHOLE\_STORAGE\_ENGINE=1 -DENABLED\_LOCAL\_INFILE=1 -DDEFAULT\_CHARSET=utf8 -DDEFAULT\_COLLATION=utf8\_general\_ci -DEXTRA\_CHARSETS=all -DMYSQL\_TCP\_PORT=3306 -DMYSQL\_USER=mysql -DSYSCONFDIR=/etc -DWITH\_SSL=yes -DWITH\_FEDERATED\_STORAGE\_ENGINE=1 -DINSTALL\_PLUGINDIR=/usr/local/mysql/plugin

gmake

gmake install

 

cp support-files/my-medium.cnf /etc/my.cnf

sudo groupadd mysql

sudo useradd `-g mysql -d` `/sbin/nologin` `mysql`

`sudo /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql`

`sudo cp support-files/mysql.server /etc/init.d/mysqld`

`sudo chmod 755 /etc/init.d/mysqld`

sudo /etc/init.d/mysqld start