Centos 6.3 下编译安装MySQL 5.5.24

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

1.cmake

 

wget 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

 

你可能感兴趣的:(mysql)