1.下載并上傳 MySQL-5.7.14.tar.gz view plain copy
“專業(yè)、務(wù)實(shí)、高效、創(chuàng)新、把客戶的事當(dāng)成自己的事”是我們每一個人一直以來堅持追求的企業(yè)文化。 創(chuàng)新互聯(lián)是您可以信賴的網(wǎng)站建設(shè)服務(wù)商、專業(yè)的互聯(lián)網(wǎng)服務(wù)提供商! 專注于成都網(wǎng)站制作、成都做網(wǎng)站、軟件開發(fā)、設(shè)計服務(wù)業(yè)務(wù)。我們始終堅持以客戶需求為導(dǎo)向,結(jié)合用戶體驗(yàn)與視覺傳達(dá),提供有針對性的項目解決方案,提供專業(yè)性的建議,創(chuàng)新互聯(lián)建站將不斷地超越自我,追逐市場,引領(lǐng)市場!
tar -zxf msql-5.7.14.tar.gz
2.安裝依賴包 view plain copy
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake
3.下載Boost庫 view plain copy
wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
4.添加用戶 view plain copy
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
5.預(yù)編譯 view plain copy
cmake . \
-DCMAKE_INSTALL_PREFIX=/application/mysql-5.7.14 \
-DMYSQL_DATADIR=/application/mysql-5.7.14/data \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/software/boost_1_59_0 \
-DMYSQL_UNIX_ADDR=/application/mysql-5.7.14/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
6.編譯安裝view plain copy
make
make install
7.修改 /etc/my.cnf view plain copy
[mysqld]
datadir=/application/mysql/data
socket=/application/mysql/tmp/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character_set_server=utf8
8.修改權(quán)限 view plain copy
chown -R mysql:mysql mysql-5.7.14/
9.建立數(shù)據(jù)庫目錄 view plain copy
mkdir data
chown mysql:mysql data
10.初始化view plain copy
bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
11.設(shè)置加密連接 view plain copy
bin/mysql_ssl_rsa_setup
12.加入系統(tǒng)服務(wù)view plain copy
cp support-files/mysql.server /etc/init.d/mysqld
修改 mysqld 文件里的 basedir datadir 屬性
chkconfig mysqld on # 設(shè)置開機(jī)自啟動
chkconfig --list | grep mysqld
13.啟動 重啟 停止 view plain copy
service mysqld start
service mysqld restart
service mysqld stop
14.登錄并修改初始密碼 copy
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('newpassword');
安裝中遇到的問題 view pcopy
Starting MySQL... ERROR! The server quit without updating PID file (/application/mysql/Rong.pid).
1.查看錯誤日志 /var/log/mysqld.log 檢查錯誤原因 view plain copy
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2.原因:在進(jìn)行初始化數(shù)據(jù)庫權(quán)限表的時候默認(rèn)創(chuàng)建的權(quán)限表在默認(rèn)目錄/usr/local/mysql/var下面,而實(shí)際是在 /application/mysql/data
3.通過需改 /etc/my.cnf 下 --datadir參數(shù)來解決問題