cmake编译安装mysql怎么卸载_cmake编译安装mysql报错问题解决办法

本文介绍了在Linux环境下使用cmake编译安装MySQL时遇到的错误及其解决步骤,包括CMake配置错误、缺少依赖库等问题。在安装过程中,通过yum安装相关软件包,如gcc、gcc-c++等,并最终成功完成编译和安装。同时,文章提到了如果需要卸载,可以删除源码目录并重新解压安装。
摘要由CSDN通过智能技术生成

1、编译安装mysql

mysql-5.6.13

2 安装cmake软件包

yum install cmake

3 create account of MySQL

groupadd mysql

useradd -g mysql mysql

autoreconf --force --install

libtoolize --automake --force

automake --force --add-missing

4  complie the sources

mkdir -p /data/mbdata

tar -xvf mysql-5.6.13.tar.gz

5 cmake

time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

[root@472322 mysql-5.6.13]# time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

-- Running cmake version 2.6.4

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.

Missing variable is:

CMAKE_C_COMPILER_ENV_VAR

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.

Missing variable is:

CMAKE_C_COMPILER

CMake Error: Could not find cmake module file:/root/mysql-5.6.13/CMakeFiles/CMakeCCompiler.cmake

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.

Missing variable is:

CMAKE_CXX_COMPILER_ENV_VAR

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.

Missing variable is:

CMAKE_CXX_COMPILER

CMake Error: Could not find cmake module file:/root/mysql-5.6.13/CMakeFiles/CMakeCXXCompiler.cmake

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

-- Configuring incomplete, errors occurred!

real    0m0.017s

user    0m0.006s

sys     0m0.005s

6 上一步cmake报错了,google得知需要重新yum make下

yum install make

ok

再继续去cmake

[root@472322 mysql-5.6.13]# time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

-- Running cmake version 2.6.4

-- 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.

-- Searching 16 bit integer

CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:31 (MESSAGE):

no suitable type found

Call Stack (most recent call first):

configure.cmake:621 (TEST_BIG_ENDIAN)

CMakeLists.txt:314 (INCLUDE)

这个错误很诡异,google上面有很多,但是每种情况都不同,我只好一个个去try了

-- Configuring incomplete, errors occurred!

报错如下: CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.

没有安装 gcc 和 gcc-c++,执行cmake报如上错误:

第一次尝试,执行

yum install -y gcc

yum install -y gcc-c++

7  继续cmake

time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

-- Searching 16 bit integer

CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:31 (MESSAGE):

no suitable type found

Call Stack (most recent call first):

configure.cmake:621 (TEST_BIG_ENDIAN)

CMakeLists.txt:314 (INCLUDE)

-- Configuring incomplete, errors occurred!

第二次尝试,有人说需要安装至少5种包

[root@472322 mysql-5.6.13]#

yum install gcc gcc-c++

yum install -y ncurses-devel.x86_64

yum install -y cmake.x86_64

yum install -y libaio.x86_64

yum install -y bison.x86_64

yum install -y gcc-c++.x86_64

然后再cmake,还是报原来的错误

最后决定用土办法了,删除所有的已经安装过的,重新再来做一遍吧。

[解决办法]:删除原来的mysql-5.6.13目录,重新解压缩tar.gz包

rm -rf /root/mysql-5.6.13

cd /root/

tar -xvf mysql-5.6.13.tar.gz

cd /root/mysql-5.6.13

time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

OK,成功了,对Linux底层不太熟悉,难道是因为前面没有事先安装好各种包而cmake出来错误的东西导致后面继续cmake就一直报错吗? 是否是需要准备好各种lib包然后才能yum install cmake呢?然后再安装mysql才能不报错呢?

8 build the db directy

time make

time make install

9 init db

ll /usr/local/mysql56/

cd /usr/local/mysql56/

chown -R mysql .

chgrp -R mysql .

cp support-files/my-default.cnf /etc/my56.cnf

scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf

[root@472322 mysql56]# scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf

/usr/local/mysql56/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com password 'new-password'

Alternatively you can ru

--defaults-file argument to mysqld_safe when starting the server

感到信息有warning,那就重新再执行一遍,原来在做5.6.10安装测试的时候,init db不管第一次执行失败或者成功,都可以再执行第二遍的。

转自:http://blog.csdn.net/u010098331/article/details/50924712

一、安装MySQL 1、安装cmake cd /usr/local/src tar zxvf cmake-2.8.11.2.tar.gz cd cmake-2.8.11.2 ./configure make make install 2、安装MySQL groupadd mysql #添加mysql组 useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统 mkdir -p /data/mysql #创建MySQL数据库存放目录 chown -R mysql:mysql /data/mysql #设置MySQL数据库存放目录权限 mkdir -p /usr/local/mysql #创建MySQL安装目录 cd /usr/local/src #进入软件包存放目录 tar zxvf mysql-5.6.19.tar.gz #解压 cd mysql-5.6.19 #进入目录 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc #配置 make #编译 make install #安装 rm -rf /etc/my.cnf #删除系统默认的配置文件(如果默认没有就不用删除) cd /usr/local/mysql #进入MySQL安装目录 ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库 ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目录的软连接 cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系统启动 chmod 755 /etc/init.d/mysqld #增加执行权限 chkconfig mysqld on #加入开机启动 vi /etc/rc.d/init.d/mysqld #编辑 basedir=/usr/local/mysql #MySQL程序安装路径 datadir=/data/mysql #MySQl数据库存放目录 :wq! #保存退出 service mysqld start #启动 vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行 export PATH=$PATH:/usr/local/mysql/bin :wq! #保存退出 source /etc/profile #使配置立刻生效 下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。 ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql ln -s /usr/local/mysql/include/mysql /usr/include/mysql mkdir /var/lib/mysql #创建目录 ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock #添加软链接 mysql_secure_installation #设置Mysql密码,根据提示按Y 回车输入2次密码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值