您的位置:首页 > 运维架构 > Linux

centos 5.9安装mysql5.7.9 +gcc编译升级

2015-12-09 17:31 459 查看
[root@zk32 mysql-5.7.9]# more /etc/redhat-release

CentOS release 5.9 (Final)

编译mysql5.7.9报错,提示需要cmake 2.8以上版本

编译安装cmake

tar zxvf cmake-2.8.10.2.tar.gz

cd cmake-2.8.10.2

./bootstrap

gmake &&gmake install

[root@zk32 ~]# cd mysql-5.7.9/

[root@zk32 mysql-5.7.9]# cmake .

-- Running cmake version 2.8.10.2

-- Configuring with MAX_INDEXES = 64U

CMake Error at cmake/os/Linux.cmake:28 (MESSAGE):

GCC 4.4 or newer is required!

Call Stack (most recent call first):

CMakeLists.txt:162 (INCLUDE)

-- Configuring incomplete, errors occurred!

当前版本的gcc

[root@zk32 ~]# gcc -v

使用内建 specs。

目标:x86_64-redhat-linux

配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux

线程模型:posix

gcc 版本 4.1.2 20080704 (Red Hat 4.1.2-54)

来看需要升级gcc了

升级步骤

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2
tar -jxvf gcc-4.8.0.tar.bz2

cd gcc-4.8.0

./contrib/download_prerequisites

cd ..

mkdir gcc-build-4.8.0

cd gcc-build-4.8.0/

../gcc-4.8.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

make -j4

使用当前的新版本GCC

mv /usr/bin/gcc /usr/local

ln -s /usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.0 /usr/bin/gcc

ln -s /usr/local/bin/x86_64-unknown-linux-gnu-g++ /usr/bin/g++

[root@zk31 ~]# gcc -v

使用内建 specs。

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper

目标:x86_64-unknown-linux-gnu

配置为:../gcc-4.8.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

线程模型:posix

gcc 版本 4.8.0 (GCC)

编译的时候提示

[root@zk31 boost]# cd /root/mysql-5.7.9

[root@zk31 mysql-5.7.9]# cmake .

-- Running cmake version 2.8.10.2

-- Configuring with MAX_INDEXES = 64U

-- SIZEOF_VOIDP 8

-- MySQL 5.7.9

-- Packaging as: mysql-5.7.9-Linux-x86_64

-- Local boost dir /usr/local/boost/boost_1_59_0

-- Local boost zip /usr/local/boost/boost_1_59_0.tar.gz

-- Found /usr/local/boost/boost_1_59_0/boost/version.hpp

CMake Error at cmake/boost.cmake:238 (FILE):

file STRINGS file "/usr/local/boost/boost_1_59_0/boost/version.hpp" cannot

be read.

Call Stack (most recent call first):

CMakeLists.txt:435 (INCLUDE)

-- BOOST_VERSION_NUMBER is

-- BOOST_INCLUDE_DIR /usr/local/boost/boost_1_59_0

-- LOCAL_BOOST_DIR /usr/local/boost/boost_1_59_0

-- LOCAL_BOOST_ZIP /usr/local/boost/boost_1_59_0.tar.gz

-- Could not find (the correct version of) boost.

-- MySQL currently requires boost_1_59_0

CMake Error at cmake/boost.cmake:76 (MESSAGE):

You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>

This CMake script will look for boost in <directory>. If it is not there,

it will download and unpack it (in that directory) for you.

If you are inside a firewall, you may need to use an http proxy:

export http_proxy=http://example.com:80

Call Stack (most recent call first):

cmake/boost.cmake:252 (COULD_NOT_FIND_BOOST)

尝试编译

cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost

可以cmake通过,make的时候还是报错,系统版本放弃安装,用5.6.10替代,安装顺利

第二步:解压缩,在根目录下复制my-default.ini 为my.ini,在my.ini文件中,加入:skip-grant-tables(不需要密码验证,直接登录)

第三步:初始化mysql目录,bin\mysqld --initialize --user=mysql

第四步:启动mysql,bin\mysqld --standalone --console

第五步:在bin目录下输入:mysql -uroot -p 进入mysql控制台

第六步:use mysql ,使用mysql数据库

第七步:修改root用户密码:UPDATE user SET authentication_string= password ('123456') WHERE User='root';

第八步:输入quit;退出mysql控制台,重新启动mysql,现在就可以用root和你的新密码登录了。

第九步:密码不过期配置:在my.ini 中加入:default_password_lifetime=0 ,设置为:0 表示密码永不过期
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: