快捷搜索:

CentOS 5.5下安装MySQL 5.5全过程分享

打开终端

切换到根目录

[shell@localhost ~]# su -安装Mysql5.5之前先卸载CentOS自带的Mysql5.0。

[root@localhost ~]# yum remove mysql

安装cmake

下载cmake源码包cmake-2.8.5.tar.gz

[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz编译安装[root@localhost]# tar xzvf cmake-2.8.5.tar.gz [root@localhost]# cd cmake-2.8.5 [root@localhost cmake-2.8.5]# ./bootstrap Error when bootstrapping CMake: Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted. 报错:缺少C的编译器。

解决方法:安装gcc编译器

可以从Linux系统的安装盘中安装,也可以简单地用yum安装

[root@localhost ~]# yum install gcc

继续cmake的安装

[root@localhost cmake-2.8.5]# ./bootstrap Error when bootstrapping CMake: Cannot find appropriate C++ compiler on this system. Please specify one using environment variable CXX. See cmake_bootstrap.log for compilers attempted. 再次报错:缺少C++编译器。

安装gcc-c++编译器

同样可以从Linux系统的安装盘中安装,或者简单地用yum安装

[root@localhost ~]# yum install gcc-c++

重复上面的操作

[root@localhost cmake-2.8.5]# ./bootstrap

没有报错后,编译安装

[root@localhost cmake-2.8.5]# make [root@localhost cmake-2.8.5]# make install[root@localhost cmake-2.8.5]# cmake -version

开始正式安装Mysql

添加mysql用户和用户组

[root@localhost ~]# groupadd mysql [root@localhost ~]# useradd -g mysql mysql

下载mysql的源码包mysql-5.5.27.tar.gz

[root@localhost ~]# wget http://dev.mysql.com/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz解压

[root@localhost ~]# cd /usr/local/[root@localhost local]# tar xzvf mysql-5.5.27.tar.gz[root@localhost local]# cd mysql-5.5.27

cmake运行

[root@localhost mysql-5.5.27]# cmake .

报错:

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/readline.cmake:126 (FIND_CURSES) cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT) CMakeLists.txt:250 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred!

解决办法:

[root@localhost mysql-5.5.27]# rm CMakeCache.txt [root@localhost mysql-5.5.27]# yum -y install ncurses-devel*

重新cmake运行

[root@localhost mysql-5.5.27]# cmake .还是有个警告

Warning: Bison executable not found in PATH有一个警告,也解决了它,缺少Bison就安装一下

您可能还会对下面的文章感兴趣: