mysql tgz 安装_mysql的安装

本文详细介绍了在CentOS6.3上通过源码安装MySQL-5.5.27的步骤,包括安装cmake、创建mysql用户和组、解压编译、初始化数据库、设置权限、配置开机自启动等。在安装过程中遇到了C编译器未找到、Bison缺失和启动问题等错误,并提供了相应的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

分类: Mysql/postgreSQL

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

这个我也不知道为啥

-- Performing Test HAVE_PEERCRED - Success

-- Looking for include files HAVE_PAM_APPL_H

-- Looking for include files HAVE_PAM_APPL_H - not found.

-- Looking for strndup

-- Looking for strndup - found

-- Looking for event.h

-- Looking for event.h - not found

-- Configuring incomplete, errors occurred!

[root@han mariadb-10.0.12]# make

make: *** No targets specified and no makefile found.  Stop.

解决:

rm CMakeCache.txt

可能是你的bison没有安装

在yum install -y bison

再次cmake试试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值