centos 5.9安装mysql 5.5.31

页面导航:首页 > 数据库 > Mysql > centos 5.9安装mysql 5.5.31

centos 5.9安装mysql 5.5.31

来源: 作者: 时间:2016-02-21 09:46 【

centos 5.9安装mysql 5.5.31在linux下安装安装mysql,会出现各种各样的依赖关系,在centos下安装mysql出现各种依赖关系[[email protected]]# tar xzvf cmake-2.8.4.tar.gz[[email protected] src]# cd cmake-2...
centos 5.9安装mysql 5.5.31
 
在linux下安装安装mysql,会出现各种各样的依赖关系,在centos下安装mysql出现各种依赖关系
[[email protected]]# tar xzvf cmake-2.8.4.tar.gz 
[[email protected] src]# cd cmake-2.8.4 
[[email protected] cmake-2.8.4]# ./configure  
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安装
 
[[email protected] ~]# yum install gcc
 
继续cmake的安装
 
[[email protected] cmake-2.8.4]# ./configure   
 C compiler on this system is: cc  
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++编译器。
 
[[email protected] ~]# yum install gcc-c++
 
重复上面的操作
[[email protected] cmake-2.8.4]# ./configue 
[[email protected] cmake-2.8.4]# make 
[[email protected] cmake-2.8.4]# make install
 
开始正式安装Mysql
 
添加mysql用户和用户组
[[email protected] ~]# groupadd mysql 
[[email protected] ~]# useradd -r -g mysql mysql
mysql的包mysql-5.5.31.tar.gz
 
[[email protected] ~]#  tar xzvf mysql-5.5.31.tar.gz
[[email protected] ~]# cd mysql-5.5.31 
 
cmake运行
 
[[email protected] mysql-5.5.31]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
 
-- Running cmake version 2.8.10.2
-- MySQL 5.5.31
-- Packaging as: mysql-5.5.31-Linux-x86_64
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:83 (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:127 (FIND_CURSES)
  cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:269 (MYSQL_CHECK_READLINE)
 
-- Configuring incomplete, errors occurred! 
 
 缺少Curses包,解决办法:remove CMakeCache.txt  and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on  Redhat and derivates it is ncurses-devel.
 
在CentOS下需要安装ncurses-devel
 
[[email protected] mysql-5.5.31]# yum install ncurses-devel
 
安装完毕,重新cmake运行
 
[[email protected] mysql-5.5.31]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
....................................................................
-- Performing Test HAVE_PEERCRED - Success
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mysql-5.5.31
 
有一个警告,缺少Bison就安装一下
 
[[email protected] mysql-5.5.31]# yum install bison
 删除CMakeCache.txt,重新cmake。接下来开始编译安装,时间有点稍长,可以干点别的看看财经新闻
 [[email protected] mysql-5.5.31]# make && make install
 
修改目录权限
[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# chown -R root:mysql .
[[email protected] mysql]# chown -R mysql:mysql data 
 
创建系统的表
[[email protected] scripts]# ./_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
 
cp配置文件 
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf 
 
启动mysql  
/usr/local/mysql/bin/mysqld_safe  --user=mysql  & 
 
修改环境变量
[[email protected] ~]# vi .bash_profile 
 
# .bash_profile
 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
 
# User specific environment and startup programs
 
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/
 
export PATH
unset USERNAME
 
如上面类似添加mysql路径
 
总结 centos 下安装很方便,因为yum已经给安装上了,缺依赖的时候会自动下载安装。
Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<