一、MySQL5.6.36安裝前準(zhǔn)備
創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司,專注成都做網(wǎng)站、網(wǎng)站制作、網(wǎng)站營銷推廣,域名申請,網(wǎng)頁空間,網(wǎng)站運營有關(guān)企業(yè)網(wǎng)站制作方案、改版、費用等問題,請聯(lián)系創(chuàng)新互聯(lián)。
(1)克隆一個模板機(jī)器(使用centos6),克隆完做快照
(2)IP 10.0.0.52 主機(jī)名db02
(3)iptables selinux
(4)下載好5.6.36
(5)安裝依賴包
yum install -y ncurses-devel libaio-devel cmake
(6)安裝cmake
yum install cmake –y
(7)創(chuàng)建用戶
useradd -s /sbin/nologin -M mysql
id mysql
二、MySQL下載安裝
(0)創(chuàng)建軟件下載目錄:
mkdir -p /server/tools
cd /server/tools/
(1)下載并上傳到/server/tools
https://www.mysql.com/downloads/
社區(qū)版MySQL Community Server
5.6 5.6.3x 5.6.34 5.6.36 5.6.38
發(fā)布超過6-12的版本
5.7 5.7.17以后
(2)解壓:
cd /server/tools
tar xf mysql-5.6.36.tar.gz
(3)安裝:
cd mysql-5.6.36
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 \
-DMYSQL_DATADIR=/application/mysql-5.6.36/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0
make && make install
三、配置并啟動
(1)制作軟連接:
ln -s /application/mysql-5.6.36/ /application/mysql
(2)拷貝配置文件到/etc:
cp support-files/my*.cnf /etc/my.cnf
(3)初始化數(shù)據(jù)庫:
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
(4)創(chuàng)建關(guān)鍵目錄并設(shè)置權(quán)限:
mkdir -p /application/mysql/tmp
chown -R mysql.mysql /application/mysql/
(5)復(fù)制啟動腳本到/etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
(6)啟動數(shù)據(jù)庫
/etc/init.d/mysqld start
netstat -lntup|grep 330
(7)配置環(huán)境變量
echo 'PATH=/application/mysql/bin/:$PATH' >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
mysql
select user,host,password from mysql.user;