在Centos 5.5 上编译安装mysql 5.5.9
创建mysql用户[root@xuhostopt]#useradd-gmysqlmysql3307-s/bin/nologin-d/usr/local/mysql3307
创建数据目录[root@xuhostopt]#mkdir/mysqldata/dirdata/mysql3307[root@xuhostopt]#chownmysql.mysql-R/mysqldata/dirdata/mysql3307
安装cmake
[root@xuhostopt]#wgethttp://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz [root@xuhostopt]#tarzxvfcmake-2.8.4.tar.gz [root@xuhostopt]#./configure [root@xuhostopt]#cdcmake-2.8.4 [root@xuhostcmake-2.8.4]#makeinstall
安装mysql5.5.9
[root@xuhostopt]#tarzxvfmysql-5.5.9.tar.gz [root@xuhostopt]#cdmysql-5.5.9 [root@xuhostmysql-5.5.9]#cmake.\ -DCMAKE_INSTALL_PREFIX=/mysqldata/mysql3307/\ -DMYSQL_DATADIR=/mysqldata/dirdata/mysql3307\ -DWITH_INNOBASE_STORAGE_ENGINE=\ -DENABLED_LOCAL_INFILE=\ -DMYSQL_TCP_PORT=\ -DEXTRA_CHARSETS=all\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8-general_ci\ -DMYSQL_UNIX_ADDR=/mysqldata/dirdata/mysql3307/mysql.sock\ -DMYSQL_USER=mysql3307\ -DWITH_DEBUG= [root@xuhostmysql-5.5.9]#make [root@xuhostmysql-5.5.9]#makeinstall
复制配置文件
[root@xuhostmysql-5.5.9]#cpsupport-files/my-medium.cnf/etc/my.cnf
复制启动脚本
[root@xuhostmysql-5.5.9]#cpsupport-files/mysql.server/etc/init.d/mysqld [root@xuhostmysql-5.5.9]#chmod/etc/init.d/mysqld
初始化数据库(进到安装目录)
[root@xuhostmysql5.5.9]#./scripts/mysql_install_db–user=mysql–ldata=/var/mysql
启动数据库
[root@xuhostmysql5.5.9]#/etc/init.d/mysqldstart
Myslq5.5.以上版本编译出现错误汇总:
CMakeWarning:Thevariable,'MYSQL_USER',specifiedmanually,wasnotusedduringthegeneration.
需要把预编译里面的MYSQL_USER去掉,即可预编译成功!