ITPub博客

首页 > Linux操作系统 > Linux操作系统 > CentOS 5.5 下源码安装 MySQL 5.5.11 概述

CentOS 5.5 下源码安装 MySQL 5.5.11 概述

原创 Linux操作系统 作者:xiaoluge 时间:2011-09-01 11:25:27 0 删除 编辑

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

安装cmake
[root@localhost ~]# cd /software/
[root@localhost software]#  tar zxvf cmake-2.8.4.tar.gz 
[root@localhost software]# cd cmake-2.8.4 

[root@localhost cmake-2.8.4]# ./bootstrap
[root@localhost cmake-2.8.4]# gmake
[root@localhost cmake-2.8.4]# gmake install

创建mysql组和用户
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost cmake-2.8.4]# cd /software/
[root@localhost software]#  tar zxvf mysql-5.5.11.tar.gz

[root@localhost software]# cd mysql-5.5.11
[root@localhost mysql-5.5.11]# 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.11]# rm CMakeCache.txt
[root@localhost mysql-5.5.11]# yum install ncurses-devel
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /software/mysql-5.5.11
[root@localhost mysql-5.5.11]# yum install bison
[root@localhost mysql-5.5.11]# cmake .

[root@localhost mysql-5.5.11]# cd /software/cmake-2.8.4
[root@localhost cmake-2.8.4]# ./configure --prefix=/usr/local/mysql
[root@localhost cmake-2.8.4]# gmake
[root@localhost cmake-2.8.4]# gmake install
[root@localhost cmake-2.8.4]# cd /software/mysql-5.5.11/
[root@localhost mysql-5.5.11]# make && make install

[root@localhost mysql-5.5.11]# cd /usr/local/mysql/
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql .
[root@localhost mysql]# chgrp -R mysql .

设置选项文件,将配置文件拷贝到/etc下
[root@localhost mysql]# cp support-files/my-large.cnf /etc/my.cnf
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
启动mysql
[root@localhost mysql]# bin/mysqld_safe --user=mysql &

为root用户设置密码
[root@localhost mysql]# bin/mysqladmin -u root password "root"
[root@localhost mysql]# bin/mysqladmin -u root -h localhost password "root"

以root用户登录mysql
[root@localhost mysql]# bin/mysql -u root

关闭mysql
[root@localhost mysql]# bin/mysqladmin -u root shutdown

方便调用,为mysql设置一个软链接
[root@localhost ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql


设置开机自启动
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@localhost mysql]# chmod +x /etc/init.d/mysql 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23446692/viewspace-706409/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-04

  • 博文量
    12
  • 访问量
    23858