系統 CenterOs 6.5
1.安裝依賴包(cmake make gcc等,其實好多都有了,不需要更新,為了防止世界被破壞,就裝下)
yum install gcc gcc-c++ -y
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
2.安裝boost庫1.59(聽高手們說,只能是這個版本,沒試過其他的,懶是樓主的本性,於是菜鳥們跟着命令走吧)
wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz tar zxvf boost_1_59_0.tar.gz mv boost_1_59_0 /usr/local/boost
3.添加用戶組和用戶mysql(又是參考了各種大神的命令)
groupadd mysql
useradd -g mysql mysql
4.下載安裝mysql5.7.13(下載時可能需要翻牆?一直開着代理的樓主不知道是否需要翻牆。。。接着就是需要root權限,當然這是確定的)
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz
tar zxvf mysql-5.7.13.tar.gz cd mysql-5.7.13 cmake -DCMAKE_INSTALL_PREFIX=/home/mysql -DMYSQL_DATADIR=/home/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost make && make install
5.初始化數據庫(就是數據庫的配置,呵呵,太給力的程序,大家要記住神一樣的密碼,樓主輸錯了無數次,終於成功)
/home/mysql/bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/data
#返回信息最后一行 2016-07-21T07:36:45.962094Z 1 [Note] A temporary password is generated for root@localhost: KQqCK:lmC15u #密碼要保存
6.調整配置文件(各種復制黏貼)
mv /etc/my.cnf /etc/my.cnf.bak cp /home/mysql/support-files/my-default.cnf /etc/my.cnf
7.啟動mySQl實例
/home/mysql/bin/mysqld_safe
8.另外開一個控制台,登陸mysql,然后輸入那令人蛋疼的密碼
cd /home/mysql/bin
./mysql -uroot -p'KQqCK:lmC15u'
9.修改密碼 alter user 'root'@'localhost' identified by '123456';
#提示信息 #Enter password: #Welcome to the MySQL monitor. Commands end with ; or \g. #Your MySQL connection id is 3 #Server version: 5.7.13 #Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. #Oracle is a registered trademark of Oracle Corporation and/or its #affiliates. Other names may be trademarks of their respective #owners. #Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> alter user 'root'@'localhost' identified by '123456';
10.至此, mysql 5.7.13編譯安裝成功.
