[TOC] 1.下載MySQL5.7 2.上傳壓縮包,並解壓 3.配置並啟動 3.1.製作軟鏈接 3.2.配置my.cnf 3.3.創建關鍵目錄並設置許可權 3.4.初始化資料庫 3.5.複製啟動腳本到/etc/init.d/mysqld 3.6.啟動資料庫 3.7.配置環境變數 ...
目錄
1.下載MySQL5.7
https://downloads.mysql.com/archives/community/
2.上傳壓縮包,並解壓
mkdir -p /server/tools
cd /server/tools/
tar xf mysql-5.7.20.tar.gz -C /application
3.配置並啟動
3.1.製作軟鏈接
ln -s /application/mysql-5.7.20/ /application/mysql
3.2.配置my.cnf
vi /etc/my.cnf
basedir=/application/mysql
datadir=/application/mysql/data
socket=/application/mysql/tmp/mysql.sock
port=3306
server_id=10
log-error=/var/log/mysql.log
log-bin=/data/binlog/my-bin
sync_binlog=1
binlog_format=row
skip_name_resolve
default_storage_engine=innodb
character-set-server=utf8
autocommit=0
[mysql]
socket=/application/mysql/tmp/mysql.sock
default-character-set=utf8
3.3.創建關鍵目錄並設置許可權
mkdir -p /application/mysql/tmp /application/mysql/data /data/binlog
chown -R mysql.mysql /application/mysql/ /data/binlog
3.4.初始化資料庫
/application/mysql/bin/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
3.5.複製啟動腳本到/etc/init.d/mysqld
cd /application/mysql
cp support-files/mysql.server /etc/init.d/mysqld
3.6.啟動資料庫
/etc/init.d/mysqld start
netstat -lntup|grep 330
3.7.配置環境變數
echo 'PATH=/application/mysql/bin/:$PATH' >>/etc/profile
tail -1 /etc/profile
source /etc/profile