centos 5.9安装mysql 5.5.31_MySQL
centos 5.9安装mysql 5.5.31
在linux下安装安装mysql,会出现各种各样的依赖关系,在centos下安装mysql出现各种依赖关系
[root@localhost]# tar xzvf cmake-2.8.4.tar.gz
[root@localhost src]# cd cmake-2.8.4
[root@localhost 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安装
[root@localhost ~]# yum install gcc
继续cmake的安装
[root@localhost 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++编译器。
[root@localhost ~]# yum install gcc-c++
重复上面的操作
[root@localhost cmake-2.8.4]# ./configue
[root@localhost cmake-2.8.4]# make
[root@localhost cmake-2.8.4]# make install
开始正式安装Mysql
添加mysql用户和用户组
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -r -g mysql mysql
下载mysql的源码包mysql-5.5.31.tar.gz
[root@localhost ~]# tar xzvf mysql-5.5.31.tar.gz
[root@localhost ~]# cd mysql-5.5.31
cmake运行
[root@localhost 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
[root@localhost mysql-5.5.31]# yum install ncurses-devel
安装完毕,重新cmake运行
[root@localhost 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就安装一下
[root@localhost mysql-5.5.31]# yum install bison
删除CMakeCache.txt,重新cmake。接下来开始编译安装,时间有点稍长,可以干点别的看看财经新闻
[root@localhost mysql-5.5.31]# make && make install
修改目录权限
[root@localhost ~]# cd /usr/local/mysql
[root@localhost mysql]# chown -R root:mysql .
[root@localhost mysql]# chown -R mysql:mysql data
创建系统数据库的表
[root@localhost scripts]# ./mysql_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 &
修改环境变量
[root@localhost ~]# 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已经给安装上了,缺依赖的时候会自动下载安装。
bitsCN.com上一篇: php生成短网址示例代码
下一篇: 界别文本中的文字与图片
推荐阅读
-
centos 5.9安装mysql 5.5.31_MySQL
-
Win7的CentOS虚拟机上安装MySQL5.6服务
-
详解腾讯云CentOS7.0使用yum安装mysql及使用遇到的问题
-
CentOS7.X源码方法安装MySQL5.7.28多实例
-
CentOS7.x使用shell脚本实现使用mysql_multi自动安装MySQL5.7.28多实例
-
CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录_php实例
-
CentOS 5.9下安装配置redis
-
centos编译安装mysql5.5_MySQL
-
CentOS下安装MySQL后中文乱码解决方案
-
centos6.4下mysql5.7.18安装配置方法图文教程