CentOS6.3源码安装mysql-5.5.27
#mysql5.5以上使用cmake代替configure编译,首先需要安装cmake
yum install cmake
# 建mysql用户和组
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# 解压tgz包,编译mysql
shell> tar zxvf mysql-5.5.27.src.tar.gz
shell> cd mysql-5.5.27
shell> cmake .
shell> make && make install
# 编译结束
# 更改用户和组属性,执行mysql_install_db初始化数据库
shell> cd /usr/local/mysql
shell> chown -R mysql:mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# (以下命令可选)拷贝配置文件到/etc目录下,启动mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# (以下命令可选)设置mysql开机自启动
shell> cp support-files/mysql.server /etc/init.d/mysql.server
安装过程并不顺利,遇到好几次错误
1.没有安装 gcc 和 gcc-c++,执行cmake报如下错误:
==================================================
[root@ice mysql-5.5.27]# cmake .
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
.
.
.
-- Configuring incomplete, errors occurred!
==================================================
解决方法:安装gcc和gcc-c++
yum install gcc
yum install gcc-c++
#删除cache文件,不删除还会报错
rm CMakeCache.txt
cmake .
2.编译快结束时,又报如下错误:
Warning: Bison executable not found in PATH
解决方法:安装bison
yum install bison
rm CMakeCache.txt
cmake .
#编译通过
make && make install
#执行时间比较长
3.无法启动mysql
bin/mysqld_safe --user=mysql & 无法启动
解决方法:
再执行一次scripts/mysql_install_db --user=mysql
为什么会这样,原因不明
阅读(16790) | 评论(1) | 转发(0) |