centos 6.8安裝mysql8.0.11 +gcc編譯升級

[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  表示密碼永不過期

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章